How to check for the existence of a response header in Nginx rules?
Posted
by
Victor Welling
on Server Fault
See other posts from Server Fault
or by Victor Welling
Published on 2010-07-30T13:58:57Z
Indexed on
2012/03/21
5:33 UTC
Read the original article
Hit count: 489
nginx
Setting up the rewriting rules for the request proved to be quite easy in Nginx. For the response, not so much (at least, not for me). I want to strip the Content-Type header from the response if the Content-Length header of the response isn't set. I have the NginxHttpHeadersMoreModule installed, so that should allow me to remove the header, but I can't seem to find a way to check for the existence of the Content-Length header of the response using a rule in Nginx's configuration. Any suggestions on how to do this would be most appreciated!
© Server Fault or respective owner