Provide an option to use Spring's forwarded header support

Previously, if the `server.use-forward-headers` property
was set to true, X-Forwarded-* headers support was provided
at the server level. The property has been deprecated in favor
of `server.forward-headers-strategy` which can be also be configured
to use Spring's forwarded header support apart from native server support.

Closes gh-5677
This commit is contained in:
Madhura Bhave
2019-04-10 11:28:37 -07:00
parent 33fecec4a8
commit 959e161555
10 changed files with 139 additions and 30 deletions

View File

@@ -969,11 +969,11 @@ construct links to itself.
If the proxy adds conventional `X-Forwarded-For` and `X-Forwarded-Proto` headers (most
proxy servers do so), the absolute links should be rendered correctly, provided
`server.use-forward-headers` is set to `true` in your `application.properties`.
`server.forward-headers-strategy` is set to `NATIVE` or `FRAMEWORK` in your `application.properties`.
NOTE: If your application runs in Cloud Foundry or Heroku, the
`server.use-forward-headers` property defaults to `true`. In all
other instances, it defaults to `false`.
`server.forward-headers-strategy` property defaults to `NATIVE`. In all
other instances, it defaults to `NONE`.
@@ -1006,7 +1006,7 @@ NOTE: You can trust all proxies by setting the `internal-proxies` to empty (but
so in production).
You can take complete control of the configuration of Tomcat's `RemoteIpValve` by
switching the automatic one off (to do so, set `server.use-forward-headers=false`) and
switching the automatic one off (to do so, set `server.forward-headers-strategy=NONE`) and
adding a new valve instance in a `TomcatServletWebServerFactory` bean.