A
A
AlexanderY2015-02-05 11:16:51
Nginx
AlexanderY, 2015-02-05 11:16:51

How to use Expires OR Cache-Control in nginx?

Google's guidelines say that:

  1. It is recommended to use either Expires or Cache-Control, but not both
  2. Similar to Last-Modified and ETag

I set the line expires 7d for statics in the nginx config, both Expires and Cache-Control are added to the headers.
Can these headers be managed in a more flexible way?
nginx is running as the only webserver, Apache is disabled.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Fateev, 2015-02-05
@svfat

You can use the add_header directive: "add_header Cache-Control public,max-age=259200;". Excluding the expires directive accordingly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question