Set Expires Header only if upstream has not already set an Expires
Thomas Glanzmann
thomas at glanzmann.de
Thu Nov 30 06:08:27 UTC 2017
Hello francis,
> > Howto set expires only if upstream does not have set an expires?
> * Francis Daly <francis at daoine.org> [2017-11-23 00:26]:
> You can set a value based on $upstream_http_expires --
> { default off; "" 7d; }
> in the appropriate "map" should set your Expires time to 7 days from
> now if there is not an Expires: header from the upstream.
thanks a lot. That solved my problem. I used the same:
map $upstream_http_expires $expires {
default off;
"" 7d;
}
server {
...
expires $expires;
}
Works like a charm. Thank you again for solving my problem. I thought about
using a map but missed the 'off' possibility and its behaviour.
Cheers,
Thomas
More information about the nginx
mailing list