7 months ago
I've deployed several Next.js applications on Railway, but I recently encountered this odd behavior with Response.redirect
. Strangely, it redirects to localhost instead of the configured domain. I'm wondering if this issue is related to the latest Next.js update or perhaps with the Railway Edge Proxy.
I created a clean new Next.js app for testing, and the problem persists. However, when I deployed it to other platform like Vercel, the issue disappeared.
Link to original issue with reproduction:
https://help.railway.app/questions/next-js-route-handler-is-returning-local-683ba64f#p-5
0 Replies
7 months ago
Vercel will strip localhost or replace it with your app's public domain.
Railway will not monkey patch your app, Railway will only ever run it as-is.
You will need to tell your code to either use the public domain or strip localhost yourself.
This would not have anything to do with the Railway platform.