Having the app issue a 301 redirect if the host field in the request object is not equal to “custom-domain.org” doesn’t have results I expected. From what I can see, a 301 response is not forwarded to the requester but followed by the proxy.
custom-domain.org hosted on Fly or indeed the same app?
Only it’s not currently possible to turn off access to
name.fly.dev (e.g Disable the default domain) and so I was wondering if your intent here was to block access using
name.fly.dev to enforce
custom-domain.org? If so … I wonder if there is some loop, where the redirect is coming back … but the custom domain … returns the redirect. And so on.
If not, I’m not sure why a 301 returned by your app would not be simply returned to the client The proxy has no need to get involved in that. Maybe try redirecting to a totally separate non-Fly site, like e.g google.com or something as a quick test, and see what happens?
It was indeed a loop. Good guess. The redirect is working perfectly fine now. Thanks for your response!