Nginx Proxying Long URL Addresses

Published on Author gryzli

If you are using Nginx as reverse proxy, you may encounter some of the following behaviors

Receiving Empty Lines In Nginx Log

Receiving 499 Status Code While Proxying

I was observing such behavior when trying to access some very long URL/URI’s through nginx proxying.

The bad thing is that Nginx doesn’t log anything usefull, that could be of help for locating the problem.

Most of the times with long url’s, the problem is inside your buffer configuration settings.

Here is how to get rid of these messages and fix the problem.

Proxying Long URL Addresses Over HTTP

For http only connections, you should add the following directives to your http {} or server{} config sections:

If your addresses are bigger than 128K, you should modify it accordingly.

 

Proxying Long URL Addresses Over HTTPS (HTTP2)

If you are using HTTPS with HTTP2 module, there are some additional settings you need to add:

Again the directives should be modified based on the sizes you are working with, but most of the times 128k would be sufficient.

 

Some More Resources

Configuring Nginx As Caching Reverse Proxy

Nginx 99: Cannot assign requested address to upstream

Nginx Caching Based On Page Size