java - 设置域名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;
}
如何设置我的自定义域而不是本地主机?
解决方案
推荐阅读
- amazon-web-services - 虚拟隔离同一 AWS 云账户中的网络
- python - Python 静默失败
- php - Laravel 在查询中使用函数
- powershell - 如何从 .txt 文件中提取 MAC 地址并将地址单独放在另一个 .txt 中
- r - 将 input$plotBrush 和 textInput 绑定在一起
- vue.js - created() 生命周期钩子中的 vue 异步调用
- sql - SQL 根据查询结果发送电子邮件,仅当查询返回结果时
- apache - 使用 htaccess,仅在 url 包含查询字符串但允许站点资源(CSS、JS 等)工作时才允许访问站点?
- html - 尝试在 Angular 表的列中加载值列表
- performance - 如何在没有最小化名称的情况下记录性能火焰图?