0

Likewise in Apache is there a way you can setup multiple headers in nginx?

 location ~.*\.(css|html|js)$ { expires 30d; 

I currently have that set, but I was thinking to make js and css expire after 90 days instead.

Is that possible?

2 Answers 2

2

Yes, you can. See the HttpHeaders and HttpHeadersMore modules.

Why would you need multiple headers to do that, though? It seems this would suffice:

 location ~.*\.html$ { expires 30d; } location ~.*\.(css|js)$ { expires 90d; } 
1
  • Thanks will look into this. Though I temporarily had Apache serve those files and for now that seems to be working. Commented Jun 8, 2011 at 19:50
0

Generally, you don't want to cache HTML pages, since they are usually static assets like CSS/JS. If you ever decide to change your HTML files, with your current 30d expires setup browsers which have already visited the site within 30 days will not request the new page.

If you, in fact, know that your HTML pages are NOT going to change except until a specific date, then you can use Expires with a given date instead of just a general 30days form when the request is served.

But you probably don't want to cache HTML...

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.