> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/ix.-how-to-guides/75.-embedded-web-servers/75.10-running-behind-a-front-end-proxy-server.md).

# 75.10 在前端代理服务器后运行

你的应用可能需要发送`302`跳转或使用指向自己的绝对路径渲染内容。当在代理服务器后面运行时，调用者需要的是代理服务器链接而不是部署应用的实际物理机器地址，通常的解决方式是代理服务器将前端地址放到headers并告诉后端服务器如何拼装链接。

如果代理添加约定的`X-Forwarded-For`和`X-Forwarded-Proto` headers（大多数代理服务器会这样做），只要将`application.properties`中的`server.use-forward-headers`设置为`true`，绝对链接就能正确的渲染。

**注** 如果应用运行在Cloud Foundry或Heroku，`server.use-forward-headers`属性默认为`true`。其他实例默认为`false`。
