Railway Issue with NextJS API Proxy
lightshire
PROOP

2 years ago

Hi,

we have a railway nextjs APP that proxies /api/ to another application.

I seem to know the fix, but I dont know the nginx template that nextjs uses with railway.

I am getting: Error 400 - Request Header Or Cookie Too Large (nginx)

I think I just to increase the nginx config to like this

http {
  ...
  client_body_buffer_size     32k;
  client_header_buffer_size   8k;
  large_client_header_buffers 8 64k;
  ...
}

How can I do it? Where is the nginx template for nextjs I can use?

Solved

5 Replies

lightshire
PROOP

2 years ago

Here is the screenshot as well

Attachments


brody
EMPLOYEE

2 years ago

Are you proxying /api/ to the other service via the private network? if not, definitely should be (assuming the application is another service in your project)


lightshire
PROOP

2 years ago

no, its outside and its another endpoint. its using nextjs proxy feature


brody
EMPLOYEE

2 years ago

Gotcha, then you would need to configure the proxy on that application, but I'm honestly not seeing how Railway or a nginx template on Railway come into play here?


ray-chen
EMPLOYEE

2 years ago

Hey! Could you elaborate on your setup? Did you deploy from a Railway template?

Next deploys on Railway are not proxied via nginx by default, so I'm curious where that error is coming from.

nextjs proxy feature

Do you mean Next's rewrite feature?


Railway
BOT

4 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 4 months ago


Loading...