2017년 12월 12일 화요일

[TechNote] Setting the X-Forwarded-For header

Setting the X-Forwarded-For header using IBM HTTP Server

Question

How do I configure IBM HTTP Server to set a header called "X-Forwarded-For" equal to the IP address of the client?

Cause

The X-Forwarded-For header is not required by IBM HTTP Server (IHS) or by IBM WebSphere Application Server (WAS). But it may be required by software from other vendors.

Answer

For more information about the X-Forwarded-For header, see the definition on Wikipedia here: http://en.wikipedia.org/wiki/X-Forwarded-For

NOTE: No configuration is necessary when IBM HTTP Server is configured as a reverse proxy, as this header is added automatically by mod_proxy_http.

To configure IBM HTTP Server to set the X-Forwarded-For header to the client IP address, in a non-proxy request, you need to enable the mod_rewrite and mod_headers modules, and then add the following lines in the IBM HTTP Server config (httpd.conf):

RewriteEngine on
RewriteRule ^(.*) - [E=CLIENT_IP:%{REMOTE_ADDR},L]
RequestHeader set x-forwarded-for %{CLIENT_IP}e


In WebSphere Application Server, J2EE APIs that access the client IP address are not affected by the X-Forwarded-For header. The IBM web server Plug-in sends the client IP address to WebSphere Application Server in proprietary ($WS) headers. To learn more about HTTP headers, including the IBM $WS headers, please see the following webcast replay:
http://www.ibm.com/support/docview.wss?uid=swg27014842 

댓글 없음:

댓글 쓰기