dynamic
dynamic

Reputation: 48091

Cache-Control: before public or max-age?

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

?

Upvotes: 9

Views: 7442

Answers (2)

Quentin Pradet
Quentin Pradet

Reputation: 4771

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.

Upvotes: 20

Mitch Dempsey
Mitch Dempsey

Reputation: 39879

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

Upvotes: 1

Related Questions