Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
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-boot-admin
Commits
019f13db
Commit
019f13db
authored
Jan 29, 2018
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
case insensitive header filtering
parent
1b47cc06
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
AbstractInstancesProxyController.java
...ot/admin/server/web/AbstractInstancesProxyController.java
+11
-9
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/AbstractInstancesProxyController.java
View file @
019f13db
...
...
@@ -24,11 +24,12 @@ import reactor.core.publisher.Mono;
import
java.net.ConnectException
;
import
java.net.URI
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpHeaders
;
...
...
@@ -41,14 +42,13 @@ import org.springframework.web.reactive.function.client.ClientResponse;
import
org.springframework.web.reactive.function.client.WebClient
;
import
org.springframework.web.server.ResponseStatusException
;
import
static
java
.
util
.
Arrays
.
asList
;
import
static
java
.
util
.
stream
.
Collectors
.
toMap
;
public
class
AbstractInstancesProxyController
{
protected
static
final
String
REQUEST_MAPPING_PATH
=
"/instances/{instanceId}/actuator/**"
;
protected
static
final
List
<
String
>
HOP_BY_HOP_HEADERS
=
asList
(
"Host"
,
"Connection"
,
"Keep-Alive"
,
protected
static
final
String
[]
HOP_BY_HOP_HEADERS
=
new
String
[]{
"Host"
,
"Connection"
,
"Keep-Alive"
,
"Proxy-Authenticate"
,
"Proxy-Authorization"
,
"TE"
,
"Trailer"
,
"Transfer-Encoding"
,
"Upgrade"
,
"X-Application-Context"
)
;
"X-Application-Context"
}
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AbstractInstancesProxyController
.
class
);
private
final
InstanceRegistry
registry
;
...
...
@@ -58,8 +58,10 @@ public class AbstractInstancesProxyController {
public
AbstractInstancesProxyController
(
Set
<
String
>
ignoredHeaders
,
InstanceRegistry
registry
,
InstanceWebClient
instanceWebClient
)
{
this
.
ignoredHeaders
=
new
HashSet
<>(
ignoredHeaders
);
this
.
ignoredHeaders
.
addAll
(
HOP_BY_HOP_HEADERS
);
this
.
ignoredHeaders
=
Stream
.
concat
(
ignoredHeaders
.
stream
(),
Arrays
.
stream
(
HOP_BY_HOP_HEADERS
))
.
map
(
String:
:
toLowerCase
)
.
collect
(
Collectors
.
toSet
());
this
.
registry
=
registry
;
this
.
instanceWebClient
=
instanceWebClient
;
}
...
...
@@ -107,8 +109,8 @@ public class AbstractInstancesProxyController {
return
filtered
;
}
private
boolean
includeHeader
(
String
header
s
)
{
return
!
ignoredHeaders
.
contains
(
header
s
);
private
boolean
includeHeader
(
String
header
)
{
return
!
ignoredHeaders
.
contains
(
header
.
toLowerCase
()
);
}
private
boolean
requiresBody
(
HttpMethod
method
)
{
...
...
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