@@ -448,6 +448,8 @@ that sets up the connector to be secure:
448
448
}
449
449
----
450
450
451
+
452
+
451
453
[[howto-enable-multiple-connectors-in-tomcat]]
452
454
=== Enable Multiple Connectors Tomcat
453
455
Add a `org.apache.catalina.connector.Connector` to the
@@ -488,6 +490,26 @@ HTTPS connector:
488
490
----
489
491
490
492
493
+
494
+ [[howto-use-tomcat-behind-a-proxy-server]]
495
+ === Use Tomcat behind a front-end proxy server
496
+ Spring Boot will automatically configure Tomcat's `RemoteIpValve` if it detects some
497
+ environment settings. This allows you to transparently use the standard `x-forwarded-for`
498
+ and `x-forwarded-proto` headers that most front-end proxy servers add.
499
+
500
+ You can switch on the valve by adding some entries to application.properties, e.g.
501
+
502
+ [indent=0]
503
+ ----
504
+ server.tomcat.remote_ip_header=x-forwarded-for
505
+ server.tomcat.protocol_header=x-forwarded-proto
506
+ ----
507
+
508
+ Alternatively, you can add the `RemoteIpValve` yourself by adding a
509
+ `TomcatEmbeddedServletContainerFactory` bean.
510
+
511
+
512
+
491
513
[[howto-use-jetty-instead-of-tomcat]]
492
514
=== Use Jetty instead of Tomcat
493
515
The Spring Boot starters (`spring-boot-starter-web` in particular) use Tomcat as an
@@ -1163,16 +1185,16 @@ is a useful template to follow.
1163
1185
1164
1186
1165
1187
[[howto-enable-https]]
1166
- === Enable HTTPS
1188
+ === Enable HTTPS when running behind a proxy server
1167
1189
Ensuring that all your main endpoints are only available over HTTPS is an important
1168
1190
chore for any application. If you are using Tomcat as a servlet container, then
1169
1191
Spring Boot will add Tomcat's own `RemoteIpValve` automatically if it detects some
1170
1192
environment settings, and you should be able to rely on the `HttpServletRequest` to
1171
- report whether it is secure or not (even downstream of the real SSL termination). The
1172
- standard behavior is determined by the presence or absence of certain request headers
1173
- (`x-forwarded-for` and `x-forwarded-proto`), whose names are conventional, so it should
1174
- work with most front end proxies. You can switch on the valve by adding some entries to
1175
- `application.properties`, e.g.
1193
+ report whether it is secure or not (even downstream of a proxy server that handles the
1194
+ real SSL termination). The standard behavior is determined by the presence or absence of
1195
+ certain request headers (`x-forwarded-for` and `x-forwarded-proto`), whose names are
1196
+ conventional, so it should work with most front end proxies. You can switch on the valve
1197
+ by adding some entries to `application.properties`, e.g.
1176
1198
1177
1199
[source,properties,indent=0]
1178
1200
----
0 commit comments