I have a service that’s currently using the render subdomain, and I want to switch to a custom domain. My service needs to know the domain in order to generate callback URLs, for example for OAuth. I’m currently just using an environment variable that specifies the domain name (currently <whatever>.onrender.com).
After adding the custom domain, how can I tell which domain the users are using to access the service? I’d like to detect when the onrender domain is used and redirect to the new domain, or at least generate callback URLs correctly (matching the current domain used).
I don’t see how that is possible on the server, as it’s sitting behind a reverse proxy, so it doesn’t know of the outside world. Also I need to know this at a request level.
Now that I think of it, I think what I’m looking for is X-Forwarded-Host. Is there any documentation on what reverse proxy Render is using and what headers it sets?