Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
a5a90fe6
Commit
a5a90fe6
authored
May 08, 2015
by
stanislavromanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
close #64
parent
b2ee6638
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
middleware/headers/headers.go
middleware/headers/headers.go
+6
-1
No files found.
middleware/headers/headers.go
View file @
a5a90fe6
...
...
@@ -5,6 +5,7 @@ package headers
import
(
"net/http"
"strings"
"github.com/mholt/caddy/middleware"
)
...
...
@@ -22,7 +23,11 @@ func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
for
_
,
rule
:=
range
h
.
Rules
{
if
middleware
.
Path
(
r
.
URL
.
Path
)
.
Matches
(
rule
.
Url
)
{
for
_
,
header
:=
range
rule
.
Headers
{
w
.
Header
()
.
Set
(
header
.
Name
,
header
.
Value
)
if
strings
.
HasPrefix
(
header
.
Name
,
"-"
)
{
w
.
Header
()
.
Del
(
strings
.
TrimLeft
(
header
.
Name
,
"-"
))
}
else
{
w
.
Header
()
.
Set
(
header
.
Name
,
header
.
Value
)
}
}
}
}
...
...
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