Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring data rest在代理设置中生成错误的实体链接_Spring_Apache_Spring Data Rest_Spring Hateoas - Fatal编程技术网

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

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"

我在Apache驱动的反向代理后面部署了Spring Boot应用程序。此代理已正确设置头
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