Skip to content

Commit cc55783

Browse files
sjoerdmulderwilkinsona
authored andcommitted
Escape backslashes in .properties examples of setting internal-proxies
In a properties file, a backslash is used as an escape character for the line terminator sequence to allow values to be split across multiple lines. When a backslash is used elsewhere they're stripped out of the property's value. This commit updates .properties-based examples for configuring server.tomcat.internal-proxies to escape the backslahes so that they are retained in the property's value at runtime. See gh-1989
1 parent 9ef8335 commit cc55783

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ content into your application; rather pick only the properties that you need.
7070
server.ssl.trust-store-type=
7171
server.tomcat.access-log-pattern= # log pattern of the access log
7272
server.tomcat.access-log-enabled=false # is access logging enabled
73-
server.tomcat.internal-proxies=10\.\d{1,3}\.\d{1,3}\.\d{1,3}|\
74-
192\.168\.\d{1,3}\.\d{1,3}|\
75-
169\.254\.\d{1,3}\.\d{1,3}|\
76-
127\.\d{1,3}\.\d{1,3}\.\d{1,3} # regular expression matching trusted IP addresses
73+
server.tomcat.internal-proxies=10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\
74+
192\\.168\\.\\d{1,3}\\.\\d{1,3}|\\
75+
169\\.254\\.\\d{1,3}\\.\\d{1,3}|\\
76+
127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3} # regular expression matching trusted IP addresses
7777
server.tomcat.protocol-header=x-forwarded-proto # front end proxy forward header
7878
server.tomcat.port-header= # front end proxy port header
7979
server.tomcat.remote-ip-header=x-forwarded-for

spring-boot-docs/src/main/asciidoc/howto.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ to `application.properties`, e.g.
493493

494494
[indent=0]
495495
----
496-
server.tomcat.internal_proxies=192\.168\.\d{1,3}\.\d{1,3}
496+
server.tomcat.internal_proxies=192\\.168\\.\\d{1,3}\\.\\d{1,3}
497497
----
498498

499499
Alternatively, you can take complete control of the configuration of the `RemoteIpValve`

0 commit comments

Comments
 (0)