Skip to content

Commit

Permalink
Set Cache-Control immutable
Browse files Browse the repository at this point in the history
Given that /ipfs/ resources never change, we can easily benefit from this
new cache control extension.

Support for this is about to land in Firefox 49:

https://bugzilla.mozilla.org/show_bug.cgi?id=1267474

For more details, there is a good blogpost about this here:

https://bitsup.blogspot.de/2016/05/cache-control-immutable.html

This header is ignored by clients that don't support it.

License: MIT
Signed-off-by: kpcyrd <git@rxv.cc>
  • Loading branch information
kpcyrd committed May 12, 2016
1 parent a2bcec4 commit c2a3e31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
modtime := time.Now()
if strings.HasPrefix(urlPath, ipfsPathPrefix) {
w.Header().Set("Etag", etag)
w.Header().Set("Cache-Control", "public, max-age=29030400")
w.Header().Set("Cache-Control", "public, max-age=29030400, immutable")

// set modtime to a really long time ago, since files are immutable and should stay cached
modtime = time.Unix(1, 0)
Expand Down

0 comments on commit c2a3e31

Please sign in to comment.