Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache-Control: before public or max-age?

Tags:

http

header

I believe they are both equivalent but to be sure I would like to know others.

Which version is correct?

  1. Cache-Control: public, max-age=60

  2. Cache-Control: max-age=60, public

?

like image 578
dynamic Avatar asked May 01 '12 17:05

dynamic


2 Answers

Here's the grammar for the Cache-Control directive from RFC 7234:

Cache-Control   = 1#cache-directive
cache-directive = token [ "=" ( token / quoted-string ) ]

1#cache-directive means that you need at least one cache-directive. Since public and max-age are both Cache-Control directives, the order doesn't matter.

like image 191
Quentin Pradet Avatar answered Sep 21 '22 21:09

Quentin Pradet


They are equivalent. Order doesn't even make a different in that scenario anyway.

like image 32
Mitch Dempsey Avatar answered Sep 21 '22 21:09

Mitch Dempsey