Francis Lavoie
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
29 additions and
0 deletions
-
caddytest/integration/caddyfile_adapt/header.txt
-
modules/caddyhttp/headers/caddyfile.go
|
|
@ -9,6 +9,10 @@ |
|
|
|
?Tim "Berners-Lee" |
|
|
|
defer |
|
|
|
} |
|
|
|
@images path /images/* |
|
|
|
header @images { |
|
|
|
Cache-Control "public, max-age=3600, stale-while-revalidate=86400" |
|
|
|
} |
|
|
|
} |
|
|
|
---------- |
|
|
|
{ |
|
|
@ -20,6 +24,27 @@ |
|
|
|
":80" |
|
|
|
], |
|
|
|
"routes": [ |
|
|
|
{ |
|
|
|
"match": [ |
|
|
|
{ |
|
|
|
"path": [ |
|
|
|
"/images/*" |
|
|
|
] |
|
|
|
} |
|
|
|
], |
|
|
|
"handle": [ |
|
|
|
{ |
|
|
|
"handler": "headers", |
|
|
|
"response": { |
|
|
|
"set": { |
|
|
|
"Cache-Control": [ |
|
|
|
"public, max-age=3600, stale-while-revalidate=86400" |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
{ |
|
|
|
"handle": [ |
|
|
|
{ |
|
|
|
|
|
@ -46,6 +46,10 @@ func init() { |
|
|
|
// and ? conditionally sets a value only if the header field is not already
|
|
|
|
// set.
|
|
|
|
func parseCaddyfile(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error) { |
|
|
|
if !h.Next() { |
|
|
|
return nil, h.ArgErr() |
|
|
|
} |
|
|
|
|
|
|
|
matcherSet, err := h.ExtractMatcherSet() |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|