7 months ago
I have a middleware in my app that redirects requests from https://myapp.io to https://www.myapp.io.
Initially when I move my production app to Railway, I turned off this middleware to allow for more controlled testing.
Today, I turned it back on, and my health checks started failing, this is because they were getting a redirection status 302.
So I added healthcheck.railway.app to the list of hostnames that are exempt from this middleware, but now when I go to https://myapp.io, the page doesn't load, no redirection happens, and I eventually get "The page took too long to respond".
I'm not interested in provisioning things like Caddy/nginx. I'd like a solution in-app. Is there any header or something else I can inspect in order to make sure the redirection works?
5 Replies
7 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
7 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 7 months ago
6 months ago
This is not an application issue or error. To me it seems like it’s an issue with the Railway platform and needs to be addressed by support.
6 months ago
Did healthchecks work before you turned off the middleware?
If you want it to work natively, you can also add the apex myapp.io as a custom domain to your service, and have your middleware do the redirect to non-apex www.
6 months ago
Did healthchecks work before you turned off the middleware?
I haven't got a chance to enable the middleware since I moved from Heroku to Railway. The middleware works perfectly, it's older than Railway.
If you want it to work natively, you can also add the apex
myapp.ioas a custom domain to your service, and have your middleware do the redirect to non-apex www.
Any idea why I didn't have to do that with Heroku?
shxkm
Did healthchecks work before you turned off the middleware?I haven't got a chance to enable the middleware since I moved from Heroku to Railway. The middleware works perfectly, it's older than Railway.If you want it to work natively, you can also add the apex myapp.io as a custom domain to your service, and have your middleware do the redirect to non-apex www.Any idea why I didn't have to do that with Heroku?
6 months ago
I did a bit of digging into the docs, it looks like railway's healthchecks come from healthcheck.railway.app https://docs.railway.com/guides/healthchecks#healthcheck-hostname
Part of me suspects that your middleware is routing anything that isnt www.myapp.io to www.myapp.io. Can I see what your middleware looks like?
If it is redirecting anything that isnt, try adding a whitelist to anything with origin healthcheck.railway.app to just resolve to the main app.