@cryptotaxi247 / kubo / commits / c2a3e3169

Set Cache-Control immutable

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>

kpcyrd committed May 12, 2016 at 12:05 UTC c2a3e3169d60f9b42bbdb8bd6359815bdc7de271
1 file changed +1 -1
core/corehttp/gateway_handler.go
+1 -1
@@ -205,7 +205,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
205 modtime := time.Now()
206 if strings.HasPrefix(urlPath, ipfsPathPrefix) {
207 w.Header().Set("Etag", etag)
208 - w.Header().Set("Cache-Control", "public, max-age=29030400")
208 + w.Header().Set("Cache-Control", "public, max-age=29030400, immutable")
209
210 // set modtime to a really long time ago, since files are immutable and should stay cached
211 modtime = time.Unix(1, 0)