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
122e3a94
Commit
122e3a94
authored
Sep 28, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite: Make internal header field name a const
parent
79a7f8a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
middleware/rewrite/rewrite.go
middleware/rewrite/rewrite.go
+7
-2
No files found.
middleware/rewrite/rewrite.go
View file @
122e3a94
...
...
@@ -51,7 +51,7 @@ func (s SimpleRule) Rewrite(r *http.Request) bool {
if
s
.
From
==
r
.
URL
.
Path
{
// take note of this rewrite for internal use by fastcgi
// all we need is the URI, not full URL
r
.
Header
.
Set
(
"Caddy-Rewrite-Original-URI"
,
r
.
URL
.
RequestURI
())
r
.
Header
.
Set
(
headerFieldName
,
r
.
URL
.
RequestURI
())
r
.
URL
.
Path
=
s
.
To
return
true
}
...
...
@@ -134,7 +134,7 @@ func (r *RegexpRule) Rewrite(req *http.Request) bool {
// take note of this rewrite for internal use by fastcgi
// all we need is the URI, not full URL
req
.
Header
.
Set
(
"Caddy-Rewrite-Original-URI"
,
req
.
URL
.
RequestURI
())
req
.
Header
.
Set
(
headerFieldName
,
req
.
URL
.
RequestURI
())
// perform rewrite
req
.
URL
.
Path
=
url
.
Path
...
...
@@ -176,3 +176,8 @@ func (r *RegexpRule) matchExt(rPath string) bool {
}
return
true
}
// When a rewrite is performed, this header is added to the request
// and is for internal use only, specifically the fastcgi middleware.
// It contains the original request URI before the rewrite.
const
headerFieldName
=
"Caddy-Rewrite-Original-URI"
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