PxPlus User Forum

Main Board => Discussions => Web Services => Topic started by: suriakumar on February 16, 2021, 01:05:25 AM

Title: BROWSER IP ADDRESS
Post by: suriakumar on February 16, 2021, 01:05:25 AM
Sir,

I want to get the browser's IP Address.  The Global variable %REMOTE_IP$ does not work.  It contains server's ip address.  It does not contain Browser's IP Address.   Please inform me how to get the Browser's IP address through PXPLUS
Title: Re: BROWSER IP ADDRESS
Post by: michaelgreer on February 16, 2021, 08:50:04 AM
In every application I have build using the webserver %remote_ip$ is always the browser/remote ip address.  In fact, I have used that as part of a "firewall" scheme to lock down access.
Title: Re: BROWSER IP ADDRESS
Post by: Mike King on February 16, 2021, 09:10:03 AM
Is it possible that you have a proxy forwarder on your site? 

Basically the %REMOTE_IP$ is the IP address at the other end of the connection which normally is the browser, but if your request are being routed through a proxy server, load balancer, VPN, or similar it will reflect the address of the server doing the redirection.

In most cases these servers will insert the true originating IP address in the request header thus in one of the global variables we provide.  Typically, although not a 100% approved standard, the originating IP address will be found in %X_Forwarded_For$ which comes from the X-Forwarded-For request header.
Title: Re: BROWSER IP ADDRESS
Post by: suriakumar on February 17, 2021, 05:48:05 AM
Sir,

In Which VERSION of pxplus you have the global variable %X_FORWARDED_FOR$ ?. I am using PXPLUS version 11.65.   This variable is not available in this Version.    The WEB SERVER Version is 1.3.17.  Or In case if you have introduced in your latest version of web server please inform me the WEB SERVER Version

J.SURIAKUMAR
Title: Re: BROWSER IP ADDRESS
Post by: Mike King on February 17, 2021, 02:41:11 PM
When the PxPlus web server runs your application it converts all HTTP request headers into global variables.

If %X_Forwarded_For$ is not set then there was no X-Forwarded-for: header in the HTTP request.  There may however be a %Forwarded$ header.

Here are some details on this header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

It is also quite possible that your server may not provide the original workstations IP address.  This is not uncommon as the IP address provides a means to help identify the user which may or may not be desirable.
Title: Re: BROWSER IP ADDRESS
Post by: mike motz on April 21, 2021, 08:23:52 PM
when debugging web issues use a line like,  FLOUT=%FLOUT; IF FLOUT<>0 THEN DUMP (FLOUT)*
after you opened the file and set %FLOUT to the channel number of the file you just created.
my dump has it as twice ... REMOTE_ADDR=76.68.62.122 and %remote_ip$="76.68.62.122"
You'll see any variable that is available in memory.