I have two spring boot applications, one of which acts as an API gateway (as discussed in the Spring Example ). The other, which is connected to the first, represents the profile service using spring-data-rest (spring-data-neo4j-rest).
The first application runs on port 8080 and uses zuul to route requests to the second as follows:
zuul: routes: profiles: path: /profiles/** url: http:
All this works fine, and requests to http: // localhost: 8080 / profile are served from a second application. The problem is that the HATEOAS links in the response are incorrect. The answer from the call to this second service is correct:
{ "_links": { "self": { "href": "http://localhost:8083/profiles{?page,size,sort}", "templated": true }, "search": { "href": "http://localhost:8083/profiles/search" } }, "_embedded": { "profiles": [ { "name": "Andrew Rutter", "_links": { "self": { "href": "http://localhost:8083/profiles/0" } } }, { "name": "Andrew Rutter", "_links": { "self": { "href": "http://localhost:8083/profiles/1" } } } ] }, "page": { "size": 20, "totalElements": 2, "totalPages": 1, "number": 0 } }
But when it returns to my Gateway API, the links are rewritten to
{ "name": "Andrew Rutter", "_links": { "self": { "href": "http://localhost:8080/profiles/profiles/0" } } }
What is the alias of the gateway path plus the actual Uri service base. I skip the zuul option to disable this behavior and just leave the hateoas uri in place with the host setup. Or is there a way for my service behind the gateway to connect to / rather to the default resource endpoint / profile (in this case), which would avoid adding an unwanted path to.
Thanks!