Hey everyone.
I’ve looked into this a bunch and have hit a wall.
In my app, the user creates an account for their business and gets a subdomain, which can be whatever they want: mybusiness.app.com
I’d love to be able to test the same code path on dev & production, but I can’t seem to get the subdomain down to the client on dev. Why would I need to do that? Because I send an initial payload of data in tags in the head, rendered visa SSR using meteor/server-render, so that the client has some initial context for which business/subdomain it’s rendering right away.
meteor/server-render has onPageLoad(sink), and sink’s got sink.request, but the problem is that on dev, sink.request.url.host is null, and sink.request.headers.host is ‘127.0.0.1:3000’.
Yes, I could set ROOT_URL for dev, however, my app requires that users be able to jump between businesses/subdomains, and I’d like to be able to test that without having to restart the server of course.
By the way, I do have some changes to /etc/hosts so that I can access my dev server at URL’s like: http://somebusiness.fakedevenvironment.com:3000, however, all the server sees is 127.0.0.1, not the hostname.
Any ideas on how I might get this all cooked up so that I can test the same code path on dev/prod?
Thanks for any help, and I hope everyone’s having a nice week so far!
EDIT: And I take it back, now I do see the expected hostname in sink.request.headers.host, which I believe will work fine for prod as well. I’m not sure what changed, but I’ll leave this here in case anyone else finds this useful.