Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
757a71f2
Commit
757a71f2
authored
Feb 07, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #762 from jbenet/ipns-gateway-fix
gateway: dont cache ipns paths
parents
03c910f9
872c64dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
core/corehttp/gateway_handler.go
core/corehttp/gateway_handler.go
+10
-4
No files found.
core/corehttp/gateway_handler.go
View file @
757a71f2
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment