Proxying setup delivering wrong cache entry in some edge cases

benzimmer nginx-forum at
Mon Dec 3 16:55:56 UTC 2018

Thanks for your answer and apologies for the long delay.

How would the $http_host ever be empty? If I make a request without it I
receive a 400 Bad Request as the HTTP spec defines it. Does Nginx still
forward the request to the upstream server and populate a cache entry?

Additionally, if I make requests to our backend without a proper
X-Forwarded-For header I will always receive a 404 and not data for a wrong

Unfortunately we're still not able to reproduce the problem on our end, but
still receive complaints from users encountering the problem.

We removed all caching from the problematic endpoint, but the problem still
seems to persist. Are there any known conditions, where Nginx would pass on
a wrong host to the upstream server for any kind of reason?

Posted at Nginx Forum:,281606,282244#msg-282244

More information about the nginx mailing list