<div dir="auto"><div>Hello!</div><div dir="auto"><br></div><div dir="auto">Thanks again for the pointers. I have caching enabled, and the purpose of this is to set different expire times based on the request (if it's cacheable). So I have 3 locations: 1 for frontpage, 1 for dynamic pages and another for static content. I can't use your example though because it will ignore those headers even for requests which shouldn't be cached, hence the $skip_cache variable check. Is there a way to tie checking a variable value to the ignore headers method?<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Wed, Jan 9, 2019, 19:00 Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
On Tue, Jan 08, 2019 at 09:55:30AM +0200, Andrei wrote:<br>
<br>
> Is there a way to conditionally use proxy_ignore_headers? I'm trying to<br>
> only ignore headers for requests which have $skip_cache = 0 for example<br>
<br>
If you want different proxy_ignore_headers settings for <br>
different requests, you have to use different location{} blocks <br>
for these requests. You can do so either by using distinct <br>
path-based locations, or by conditionally routing some requests to <br>
a different location (e.g., with the "rewrite" directive).<br>
<br>
In the particular case of requests to /abc, consider something <br>
like this:<br>
<br>
location = /abc {<br>
proxy_pass ...<br>
proxy_cache ...<br>
proxy_ignore_headers Expires Cache-Control;<br>
proxy_cache_valid 5m;<br>
}<br>
<br>
Note well that it makes little to no sense to only ignore Expires <br>
and Cache-Control on cached requests, since these headers are only <br>
used by nginx for caching. If caching is not used, these headers <br>
are ignored anyway. See <a href="http://nginx.org/r/proxy_ignore_headers" rel="noreferrer noreferrer" target="_blank">http://nginx.org/r/proxy_ignore_headers</a> <br>
for details.<br>
<br>
-- <br>
Maxim Dounin<br>
<a href="http://mdounin.ru/" rel="noreferrer noreferrer" target="_blank">http://mdounin.ru/</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank" rel="noreferrer">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div></div></div>