I am facing problem when i trying to access another REST API(registered in ZUUL route) from zuul pre-filter, the call is becoming recursive i.e its running my pre-filter code again and again. My Usecase is as follows-
In Zuul PreFilter run() method, I am validating the token passed in the header.
After validating the token, I am calling one rest service(User Location Service) to fetch the user details. My User Location Service is itself registered in ZUUL as below:
user-location-service:
path: /userLocationService/**
url: http://localhost:9002
The problem is that the JWT token validation code is running again and again, Can you please suggest some solution where I can apply the call Userlocation service so that the PreFilter code would not run again and again?
Your User Location Service is registred in Zuul. So, all the times your filter is going to be executed when you got caugth in an infinite loop.
There are two approaches here:
you need to allow sensitiveHeaders.
zuul:
routes:
resource:
path: /resource/**
url: http://localhost:8002/
sensitiveHeaders: Cookie,Set-Cookie