spring-data-rest 在代理设置中生成错误的实体链接

spring-data-rest generating wrong entity links in proxy setup

我在 Apache 支持的反向代理后面部署了我的 Spring 启动应用程序。此代理已正确设置 headers X-Forwarded-ProtoX-Forwarded-Host。但是,spring-data-rest 会生成奇怪的实体并指向链接。 例如。请求 news 资源:

GET https://myproxyhost.net/api/news

对此的回应:

{
  "_embedded" : {
    "news" : [ {
      "title" : "Testnews",
      "_links" : {
        "self" : {
          "href" : "https://myproxyhost.net/api/news/api/news/1"
        },
        "news" : {
          "href" : "https://myproxyhost.net/api/news/api/news/1{?projection}",
          "templated" : true
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "https://myproxyhost.net/api/news/api/news"
    },
    "profile" : {
      "href" : "https://myproxyhost.net/api/news/api/profile/news"
    },
    "search" : {
      "href" : "https://myproxyhost.net/api/news/api/news/search"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 1,
    "totalPages" : 1,
    "number" : 0
  }
}

如您所见,链接以某种方式翻了一番,我不知道为什么。我使用的唯一 spring-data-rest 具体 属性 是:

spring.data.rest.base-path=/api

此外,在我的本地设置中一切正常,所以我猜代理对此负有某种责任。

有人知道这里出了什么问题吗?提前致谢!

问题是 ReverseProxy 设置的配置不正确导致了类似

的网址
http://proxiedhost.net:8080//api/news

因此导致出现上述问题中提到的奇怪网址。