Nginx url limit 502 gateway

谁说胖子不能爱 提交于 2020-12-08 07:22:27

问题


I have a question but I accept other suggestions that bypass this feature.

Basically I'm sending big lines of text ~3000 characters to my server in a get request and the server sends it to google translate as params in a url.

The problem: Nginx throws me a 502 bad gateway error when the url is > 1900 characters.

How can I increase the limit of my nginx url?

Alternative Solution: Sending a post request with the 3000 characters in a JSON as a string?


回答1:


To answer your question, there is a setting you can change in the nginx.conf file containing your server's configuration.

Set the following setting to something that seems fitting to your situation:

large_client_header_buffers 4 16k;

Find the documentation for it here.

I would suggest to use a POST request in case your ~3000 character requests get bigger and your nginx configuration reaches it limit.




回答2:


The important thing to notice here is that a 502 error is a problem downstream. You're probably using nginx as a reverse proxy, and it's the service that you're forwarding to which is failing.

In my case, I was using nginx to forward traffic to a docker instance which was using uwsgi. So I needed to up the 'buffer-size' parameter in my uwsgi configuration. But your specific solution will depend on the service that you're forwarding to.



来源:https://stackoverflow.com/questions/40426157/nginx-url-limit-502-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!