Find the original hostname of the orginial Api caller

Hello everyone,

i' m trying to get the original hostname of the original API caller.

I'm sending the request to Apigee through ngrok with a Spring boot application, and the endpoint of the exposed ngrok is this :

https://535a16a49bf6.ngrok.io/reverse/apigee

if I inspect the header that i sent with the request , i see the Host header correctly set in 535a16a49bf6.ngrok.io.

Howewer in Apigee,if i get "request.header.host" in a Javascript policy, in Preflow request, i see that Apigee override the Host header setting the value of the target endpoint.

I've tried all the solutions found in this forum, but nobody works. How i can retrieve the original hostname of the caller?

Thanks

0 3 135
3 REPLIES 3

Not applicable

you need to use request.header.X-Forwarded-For to get the ip of original requester.

Tnx but i need the host, not the IP

Not applicable

Yes, the host does get overridden by the apigee host. You can pass the host of the ngrok with some different header or query param, so that you can collect that in apigee.