首页 > 解决方案 > 设置域名spring boot href

问题描述

我在云中运行 spring boot war api 端点,但是当我使用 linkTo 方法返回对象的 hrefs 时,我不断得到“http://localhost:8002/api/xxx”而不是我的自定义域“http ://example.com/api/xxx”。

我正在使用 Nginx 反向代理并在端口 8002 上运行 .war 文件,因为 8080 已被另一个进程使用,这是我的 nginx 配置:

location  /api {
         proxy_pass http://localhost:8002/api;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
    }

如何设置我的自定义域而不是本地主机?

标签: javaspringspring-bootnginxtomcat

解决方案


推荐阅读