Localhost:8080 in nextjs with railway deployment

lokeshahire
FREE

2 months ago

I have deploying Next.js apps on Railway. However, I have encountered an unusual error in this particular project. In the route handler, the URL from the request object returns "localhost" instead of the configured domain.
while deploying in vercel it was wroking fine but in railway deployment redreicting to 8080 localhost for some pages

$10 Bounty

2 Replies

lokeshahire
FREE

2 months ago

N/A


lokeshahire
FREE

2 months ago

Project ID: N/A


lokeshahire
FREE

2 months ago

I have deploying Next.js apps on Railway. However, I have encountered an unusual error in this particular project. In the route handler, the URL from the request object returns "localhost" instead of the configured domain.
while deploying in vercel it was wroking fine but in railway deployment redreicting to 8080 localhost for some pages


2 months ago

https://github.com/vercel/next.js/discussions/34571 I'd take a look here. Might have to do with things being a forwarded port


longbuivan
HOBBY

a month ago

I think this is because hard code of your code base. Have you try to redirect with condition? Like add Env = production vs env = local. Then add env ib railway?