spring data rest在代理设置中生成错误的实体链接
我在Apache驱动的反向代理后面部署了Spring Boot应用程序。此代理已正确设置头spring data rest在代理设置中生成错误的实体链接,spring,apache,spring-data-rest,spring-hateoas,Spring,Apache,Spring Data Rest,Spring Hateoas,我在Apache驱动的反向代理后面部署了Spring Boot应用程序。此代理已正确设置头X-Forwarded-Proto和X-Forwarded-Host。然而,SpringDataREST生成奇怪的实体和enpoint链接。 例如,请求新闻资源: GEThttps://myproxyhost.net/api/news 对此的答复: { "_embedded" : { "news" : [ { "title" : "Testnews", "_links"
X-Forwarded-Proto
和X-Forwarded-Host
。然而,SpringDataREST生成奇怪的实体和enpoint链接。
例如,请求新闻
资源:
GEThttps://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数据rest特定属性是:
spring.data.rest.base-path=/api
另外,在我的本地设置中,一切正常,所以我想代理应该对此负责
有人知道这里出了什么问题吗?提前谢谢 问题在于ReverseProxy设置的配置不正确,这导致了类似URL的URL
http://proxiedhost.net:8080//api/news
这导致了上述问题中提到的奇怪的URL