Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
bea48c51
Commit
bea48c51
authored
Sep 08, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #515 from CPGFinanceSystems-master
* CPGFinanceSystems-master: Add X-Forwarded-Proto HTTP header to zuul proxy requests
parents
46860e5c
cbc7aa37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
PreDecorationFilter.java
...k/cloud/netflix/zuul/filters/pre/PreDecorationFilter.java
+4
-0
PreDecorationFilterTests.java
...ud/netflix/zuul/filters/pre/PreDecorationFilterTests.java
+2
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre/PreDecorationFilter.java
View file @
bea48c51
...
...
@@ -21,6 +21,7 @@ import java.net.URL;
import
javax.servlet.http.HttpServletResponse
;
import
com.netflix.zuul.constants.ZuulHeaders
;
import
lombok.extern.apachecommons.CommonsLog
;
import
org.springframework.cloud.netflix.zuul.filters.ProxyRouteLocator
;
...
...
@@ -91,6 +92,9 @@ public class PreDecorationFilter extends ZuulFilter {
"X-Forwarded-Host"
,
ctx
.
getRequest
().
getServerName
()
+
":"
+
String
.
valueOf
(
ctx
.
getRequest
().
getServerPort
()));
ctx
.
addZuulRequestHeader
(
ZuulHeaders
.
X_FORWARDED_PROTO
,
ctx
.
getRequest
().
getScheme
());
if
(
StringUtils
.
hasText
(
route
.
getPrefix
()))
{
ctx
.
addZuulRequestHeader
(
"X-Forwarded-Prefix"
,
route
.
getPrefix
());
}
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/pre/PreDecorationFilterTests.java
View file @
bea48c51
...
...
@@ -80,6 +80,7 @@ public class PreDecorationFilterTests {
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
assertEquals
(
"/foo/1"
,
ctx
.
get
(
"requestURI"
));
assertEquals
(
"localhost:80"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-host"
));
assertEquals
(
"http"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-proto"
));
assertEquals
(
"/api"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-prefix"
));
assertEquals
(
"foo"
,
getHeader
(
ctx
.
getOriginResponseHeaders
(),
"x-zuul-serviceid"
));
}
...
...
@@ -94,6 +95,7 @@ public class PreDecorationFilterTests {
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
assertEquals
(
"/1"
,
ctx
.
get
(
"requestURI"
));
assertEquals
(
"localhost:80"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-host"
));
assertEquals
(
"http"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-proto"
));
assertEquals
(
"/api/foo"
,
ctx
.
getZuulRequestHeaders
().
get
(
"x-forwarded-prefix"
));
assertEquals
(
"foo"
,
getHeader
(
ctx
.
getOriginResponseHeaders
(),
"x-zuul-serviceid"
));
}
...
...
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