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
a4c995a3
Unverified
Commit
a4c995a3
authored
Jan 03, 2018
by
Ryan Baxter
Committed by
GitHub
Jan 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable following redirects in SimpleHostRoutingFilter. Fixes #2578. (#2608)
parent
9deab33d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
SimpleHostRoutingFilter.java
...d/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
+1
-1
SimpleHostRoutingFilterTests.java
...flix/zuul/filters/route/SimpleHostRoutingFilterTests.java
+20
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
View file @
a4c995a3
...
...
@@ -220,7 +220,7 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
.
setCookieSpec
(
CookieSpecs
.
IGNORE_COOKIES
).
build
();
return
httpClientFactory
.
createBuilder
().
setDefaultRequestConfig
(
requestConfig
).
setConnectionManager
(
this
.
connectionManager
).
build
();
setConnectionManager
(
this
.
connectionManager
).
disableRedirectHandling
().
build
();
}
private
CloseableHttpResponse
forward
(
CloseableHttpClient
httpclient
,
String
verb
,
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java
View file @
a4c995a3
...
...
@@ -196,6 +196,20 @@ public class SimpleHostRoutingFilterTests {
assertTrue
(
"Get 1"
.
equals
(
responseString
));
}
@Test
public
void
redirectTest
()
throws
Exception
{
setupContext
();
InputStreamEntity
inputStreamEntity
=
new
InputStreamEntity
(
new
ByteArrayInputStream
(
new
byte
[]{}));
HttpRequest
httpRequest
=
getFilter
().
buildHttpRequest
(
"GET"
,
"/app/redirect"
,
inputStreamEntity
,
new
LinkedMultiValueMap
<
String
,
String
>(),
new
LinkedMultiValueMap
<
String
,
String
>(),
new
MockHttpServletRequest
());
CloseableHttpResponse
response
=
getFilter
().
newClient
().
execute
(
new
HttpHost
(
"localhost"
,
this
.
port
),
httpRequest
);
assertEquals
(
302
,
response
.
getStatusLine
().
getStatusCode
());
String
responseString
=
copyToString
(
response
.
getEntity
().
getContent
(),
Charset
.
forName
(
"UTF-8"
));
assertTrue
(
response
.
getLastHeader
(
"Location"
).
getValue
().
contains
(
"/app/get/5"
));
}
@Test
public
void
zuulHostKeysUpdateHttpClient
()
{
setupContext
();
...
...
@@ -259,6 +273,12 @@ class SampleApplication {
public
String
getString
(
@PathVariable
String
id
,
HttpServletResponse
response
)
throws
IOException
{
return
"Get "
+
id
;
}
@RequestMapping
(
value
=
"/redirect"
,
method
=
RequestMethod
.
GET
)
public
String
redirect
(
HttpServletResponse
response
)
throws
IOException
{
response
.
sendRedirect
(
"/app/get/5"
);
return
null
;
}
}
class
GZIPCompression
{
...
...
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