<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello All!<div><br></div><div><div>I'm running a reverse proxy and I want to trap when upstream is sending me: </div><div><br></div><div>  <font face="monospace, monospace">Content-Encoding: gzip</font></div><div><br></div><div>...and on those occasions return (probably) 406 downstream to the client; the reason for this is that I am always using:</div><div><div><br></div><div>  <font face="monospace, monospace">proxy_set_header Accept-Encoding "identity";</font></div><div><br></div><div>...so the upstream should <b>never</b> send me gzip/etc; but sometimes it does so because of errors with CDN configuration and "Vary:" headers, and that kind of thing. I would like to make the situation more obvious and easier to detect.</div><div><br></div><div>I have been trying solutions like:</div></div><div><br></div><div><div>  <font face="monospace, monospace">if ( $upstream_http_content_encoding ~ /gzip/ ) { return 406; }</font></div><div><br></div></div><div>and:</div><div><br></div><div><div><font face="monospace, monospace">  map $upstream_http_content_encoding $badness { </font></div><div><font face="monospace, monospace">  br 1; </font></div><div><font face="monospace, monospace">  compress 1; </font></div><div><font face="monospace, monospace">  deflate 1; </font></div><div><font face="monospace, monospace">  gzip 1; </font></div><div><font face="monospace, monospace">  identity 0; </font></div><div><font face="monospace, monospace">  default 0; </font></div><div><font face="monospace, monospace">  }</font></div><div><font face="monospace, monospace">  ...</font></div><div><font face="monospace, monospace">  server { ...</font></div><div><font face="monospace, monospace">  if ($badness) { return 406; } </font></div></div><div><br></div><div>...but nothing is working like I had hoped, I suspect because I do not know if/where to place the if-statement such that the upstream_http_content_encoding is both set and valid during an appropriate processing phase.</div><div><br></div><div>The most annoying thing is that I can see that the upstream_http_content_encoding variable is set to "gzip", because if I do:</div><div><br></div><div><font face="monospace, monospace">  more_set_headers "Foo: /$upstream_http_content_encoding/";<br></font></div><div><br></div><div>...then I can see the "Foo: /gzip/" value on the client; but that does not help me do what I want. </div><div><br></div><div>Can anyone suggest a route forward, please?</div><div><br></div><div>    -a</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><a href="http://dropsafe.crypticide.com/aboutalecm" target="_blank">http://dropsafe.crypticide.com/aboutalecm</a><br></div></div></div></div></div></div></div></div></div></div>