问题
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