Is there a means to set the host & port for the Spring HATEOAS `ControllerLinkBuilder`?

前端 未结 2 1564
故里飘歌
故里飘歌 2021-01-12 06:13

Spring HATEOAS provides the handy ControllerLinkBuilder to create links to controller methods, which will be added as hrefs in the JSON/XML returned to a client

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-12 06:51

    Spring-Boot uses an older version of Spring-HATEOAS, i think it was .11 that they added support for X-Forwarded-Port and X-Forwarded-Ssl headers, just add that explicit version to your POM and if your proxy is doing the right thing and adding those headers you should be good to go.

    Also if your proxy can be configured to NOT rewrite the HOST header the built in controller link builder will work just fine.

提交回复
热议问题