Client IP - when using reverse proxy

Hi Team,

Is there anyway we can obtain the Client IP via GetIP if we use reverse proxy approach? Possible to extend HttpHandler to achieve the same?


thank you

Regards


Hi Rajendra,

This works for me:

  • Use GetRequestHeader (from Extension HttpRequestHandler) with parameter "X-Forwarded-For".

Cheers,

José

Hi Jose,

Thanks for your reply. I will try out with this parameter. 


Regards

Raj

José Costa wrote:

Hi Rajendra,

This works for me:

  • Use GetRequestHeader (from Extension HttpRequestHandler) with parameter "X-Forwarded-For".

Cheers,

José

Hi Jose,

I have tried this method but it doesn't work with, It throws a empty value from the GetRequestHeader server action.


Regards

Arun


Hi Rajendra,

Not sure if this is what you are looking for but I have created a Forge component called ServerIP, (https://www.outsystems.com/forge/component-overview/5004/server-ip) which is an extension which gets the IP address according to a 3rd party server. We have used this in the past to get the IP address of an OutSystems server for white-listing purposes.

Hope this helps,

Nick

Hi Arun,

Is you server behind a proxy? That header value that I mentioned is normally set by the proxy.

If your server is not behind a proxy you can get the IP of the client by using the Server Action GetIp from the HTTPRequestHandler module.

Cheers,

José

José Costa wrote:

Hi Arun,

Is you server behind a proxy? That header value that I mentioned is normally set by the proxy.

If your server is not behind a proxy you can get the IP of the client by using the Server Action GetIp from the HTTPRequestHandler module.

Cheers,

José


Hi Jose,


Now I'm using getip function available in HTTPRequestHandler, but it returns the server IP always. I don't know the reason why.

Regards

Arun


Hi Arun,

If it always returns the same IP value it means you are using a proxy between the client and the server where the applications are.

And I guess that your proxy is not adding the "X-Forwarded-For" to the header.

At this point I would say that your best option is to do a search on how to set the X-Forwarded-For for the particular proxy that you are using.

Cheers,

José