add header Expires and Cache-Control when response is 404
nginx-forum at nginx.us
Wed Feb 9 17:19:34 MSK 2011
I need to add header Expires, when the response code is 404.
Unfortunately HttpHeadersModule can set the header just when the
response is 200, 204, 301, 302 or 304. It's no problem to add the header
using HttpHeadersMoreModule even if the status is 404. But It is written
in description of HeadersMoreModule:
"Unlike the standard headers module, this module does not automatically
take care of the constraint among the Expires, Cache-Control, and
Last-Modified headers. You have to get them right yourself or use the
headers module together with this module."
How can it be done using both modules together? Or another idea? Or, how
can I get time that would represent: now + 24h and then add this value
to the header using more_set_headers directive?
more_set_headers 'Expires: $time_now_plus_24h'
Thank in advance,
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,173527,173527#msg-173527
More information about the nginx