I am working on a flow where I have ng4+boot app running on https://host_a:8080 and a backend service at https://host_b:8080 with some APIs.
I have RestController
/Path
at both the hosts, i.e. I need some urls to hit localhost
(host_a
) and others to host_b
.
In application.yml
, I have tried almost all possible combinations of Zuul routes but still getting 404 for all host_b rest APIs. host_a
APIs work well.
Note: We have this working when there is no rest API on host_a and no custom filter on host_a
.
host_a
I am aware that I can use forward property to route to localhost
which works well. But somehow host_b
rest all gives 404 error.
My implementation requirements-
http://host_a:8080/api/abc/user to hit at localhost
i.e. host_a
http://host_a:8080/api/xyz/getall to hit at host_b
Important- Need a custom zuul filter which adds certain headers to request before it's routed to host_b as explained in point 2. - Already at place, but cannot see logs inside it now.
What I tried already-
zuul:
routes:
xyz:
path: /api/xyz/**
url: http://host_b:8080/api/xyz
I tried almost everything, using prefix, strip-prefix, only host in url, using forward for local routing, etc. Nothing works.
Kindly help me with the possible causes I may be ignoring or if missing something?
Thanks in advance.
Finally, I was able to resolve issues.
1. I had to change jersey @Path to spring @RestController
2. Changed Zuul Filter order from 1 to 999.
Works well now.