September 3rd, 2013, 11:51 PM
-
Client IP in HTTP header
Hi all,
We have a Server 2008 R2 web server that accepts requests and then forwards these requests on to an application server. The application team would then like to forward traffic from the application server to another server based on client IP address. The application team would like the client IP address placed in the header of the HTTP request so that their application can then route accordingly.
I have been investigating URL rewrites but am having some trouble achieving what I want. I essentially would like the client IP included in the HTTP request comming from client workstations but when I view the header request information with the dev tools in Google Chrome I am not able to see any client IP or associated variable as per below header
Code:
Request URL:https://webserver.com.au/webtop/component/main?__dmfClientId=1378267676955&__dmfTzoff=-480
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:JSESSIONID=38826D2A328AD5DA30979E7DD6E29C64; appname=webtop; d6_wdk_pref0=eJxTMTG2TclPLs1NzSspzbVRVDE1sXUsLS4pSszJTNQPSC0qyQAKGlnaWhmaWFjqePoFuEbEF6QWxRcU5afYKAIAhNIUCQ..; wdk_sess_cookie_0=eJxTMTG3NbawMDJzMXI0NrJwdDF1cTQ2sDS3dDV3cTFzNbJ0NjOxUVQxMbPV9/QLcI2IL0gtii8oyk+BcBUy8xQcS4tLihJzMhNB6ixsk3MSi4szk0EcS9uM/NzU5MSkzLzUkni4BAARsiJn; allFreshClient=%%cookieTS__client2##1378263296644%%__dmfFreshClient__client2##stale%%__dmfFreshForm__client2##1378263241611; lockFresh=free; __dmfClientId=1378263237631; DMSESSION=B0m2TNFXRDs7QnkETeFIJg/CYqSmG4fgnVintJn1vA/5RUWXrdo6sQpKlAgvXctY2n1U3mtFiAiJNb8I++NomJcrSBv7o2ApJqSZungonvKQOtP8LZeNLpyN4QstH2xu0Uj4o71pZDM19sHTxiGzEQjn+QD4TBiwo2wxf+E9otb05BOqcqyM4+6HPbPn/uInrlsWNL0GuVRXbRn4clh5fG20bxOVAZuaminnYQ3aSlGfu32hpBaPZyWYM/BkiwXENa2bc9s16BQSqILyAFpGKgo1lf24/jN9DrWroF5DOrvQZ8721hemAR3KA3in9sYpclPZQIRMYI2ZRbTvJo+ZXK/TNFGPbE33VWLmkVTYLti0Zm3kM8hx24jUymQzhrfkTwnOcN0LFasdKav9TcjJtSYo7ElYHefnZuBCObn0I93ZBuSI9Kp8otlvvNqg6uvctdnFns9jTG+wRO96EDhFU7FjuZ4JoCGdMOG+B9ZQPrQJV2DHF53kwha7BKta98+q2rtr6RTz/Qk6tIQm0rZL1OVJTeoPMz4WwtJeqWxAdO+79ZHo+k4owARo1ieL8LKvTH2q/WlYlYoMuNxOzxneA/JttTFAhkfl3VRu/lDPdt84I3BnzsLD1vDzLE4EklhL7dw6soka3cpCQJEjqNkngN0UsC97DEHhth43mGXf+rhu79l+bVf5MfYCCLojnWSSJ3axQ19+rhXLMjcbZXPhhg+SYi6043n0BHZxWqU0dxMF2BMlm6m1k/aDz0P9VeX2K5mXEnZlhosCtiJo7vAkQpzclNtOwyKzhj8+Cp5fC6rNKUWcrhdk6h5vA1cqkXlATIEyT1SfNwYYnZZLDwic8QRwcLumJol8QGKTb5mbYgO+31uFyQve27u7dIk/s3n8+LDVaF49Y13SArjyK2bdy6xXFvMoEvc3POJgkNsFyZ2/rWAydKh6Fj47dmqaQPyHnWogwIw/g5iX5SWStaezCAhHs3zzKU3Mjm5ehjPROkFoV5s9Etc3MWrc56+3OyvYDzaHZcRSnniUhBzxImzqs22IERSbVP21fBcUF9N5c8BUNDHFV16K3PoX0bgeYkuIvbqKatwgvyLsJyzSgedNrbdVv4HSmP23NuHUTNmShLcmFtDtZ2I9OdGFi/sxOd0yp+FoU/ruAHMdWQsjU0rK1I0Iy5rFFtBvpVs0sKl2Yu0UCc30T64yaas7aFHWUKO7RSPtc2XGTp+vuFktFv+jqIRUJRmEcuJA
Host:webserver.com.au
Referer:https://webserver.com.au/webtop/wdk/redirect.jsp?ReLoad=1378267676894&__dmfUrl=/webtop/component/main
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36
Query String Parametersview sourceview URL encoded
__dmfClientId:1378267676955
__dmfTzoff:-480
Does anyone have any information about getting the client / requesting IP address to display the the HTTP request header ?
Thanks
Trev
September 4th, 2013, 01:24 AM
-
The client IP address is provided to scripts as part of CGI and comes from the TCP/IP packet. Low-level networking stuff. It's not actually sent in the HTTP request headers.
The forwarder/load balancer/whatever has to add a custom header, like X-Forwarded-For. Any decent proxying software should offer that option if not outright provide it. Then that's what their application would look for: X-Forwarded-For if present, client IP provided through CGI if not.
Last edited by requinix; September 4th, 2013 at 01:26 AM.
September 4th, 2013, 04:24 PM
-
Thanks for the information requinix. I didn't think the client IP address was transported in the request header. Not sure if our proxy is setup to use the http_x_forwarded_for variable but I will check that today.
Thanks
Trev
October 25th, 2013, 01:31 AM
-
Thanks for the information