Commit 757a71f2 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #762 from jbenet/ipns-gateway-fix

gateway: dont cache ipns paths
parents 03c910f9 872c64dd
......@@ -209,14 +209,20 @@ func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
// set these headers _after_ the error, for we may just not have it
// and dont want the client to cache a 500 response...
w.Header().Set("Etag", etag)
w.Header().Set("Cache-Control", "public, max-age=29030400")
// and only if it's /ipfs!
// TODO: break this out when we split /ipfs /ipns routes.
modtime := time.Now()
if strings.HasPrefix(urlPath, IpfsPathPrefix) {
w.Header().Set("Etag", etag)
w.Header().Set("Cache-Control", "public, max-age=29030400")
// set modtime to a really long time ago, since files are immutable and should stay cached
modtime = time.Unix(1, 0)
}
if err == nil {
defer dr.Close()
_, name := gopath.Split(urlPath)
// set modtime to a really long time ago, since files are immutable and should stay cached
modtime := time.Unix(1, 0)
http.ServeContent(w, r, name, modtime, dr)
return
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment