Sunteți pe pagina 1din 3

6/25/2019 Document 1403073.

PowerView is Off zelko (Available) (0) Contact Us Help

Dashboard Knowledge Service Requests Patches & Updates Community

Give Feedback...
Copyright (c) 2019, Oracle. All rights reserved. Oracle Confidential.

How To Log The X-Forwarded-For HTTP Header Content In the Oracle iPlanet Web Server Access Log (Doc ID To Bottom
1403073.1)

In this Document Was this document helpful?

Goal Yes
No
Solution

Document Details

APPLIES TO: Type:


HOWTO
Status:
PUBLISHED
Last Major
Oracle iPlanet Web Server - Version 6.1 to 7.0 [Release 6.1 to 7.0] Update:
06-Aug-2013
Information in this document applies to any platform. 02-Nov-2018
Last Update:
***Checked for relevance on 05-Aug-2013***

GOAL Related Products


Oracle iPlanet Web Server
The X-Forwarded-For HTTP header contains the originating IP address of a client connecting to a web server through a load
balancer(or an HTTP proxy), since the load balancer acts as a proxy and thus all requests look like they are coming from the Information Centers
load balancer. So the default logging of the web server will log the load balancer's IP not the real client IP in the log. How can
the logging be customized to log the X-Forward-For header that contains the original client IP address? Information Center: Oracle
iPlanet Web Server
[1371388.2]

SOLUTION
Document References

Steps for Oracle iPlanet Web Server 7.0: No References available for
this document.
1. Login to the admin server GUI
Recently Viewed
2. Click on the Configuration tab
Unable To Install SSL
3. Click on the configuration name Certificate in Oracle iPlanet
Web Server - "ADMIN4112:
No Private key found"
4. Click on the General tab [1290258.1]
All Java SE Downloads on
5. Click on the "Access Log Preferences" link on the current page MOS [1439822.1]

6. Check the radio button next to the "Custom Log Format" and add %Req->headers.x-forwarded-for% to the format. See the
below screen shot.

Note: you have to use lower cases of the header name.

7. Click the Save button.

8. You will most likely get the below warning window:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=240829430714091&parent=EXTERNAL_SEARCH&sourceId=HOWTO&id=… 1/3
6/25/2019 Document 1403073.1

You have two options here:

1) Click cancel to return to previous page to change the access log File Location, Or

2) Click OK to use the existing file location for the access log. Note: If you choose this option, you would need to delete the
access file after having backed it up so that a new access file will be created upon restart of the server, and the new access log
will have the new logging format in the first line.

9. Deploy the configuration change and restart the server.

The server.xml file will contain the following:

<access-log>
<file>../logs/access</file>
<format>%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req-
>srvhdrs.clf-status% %Req->srvhdrs.content-length% - %Req->headers.x-forwarded-for%</format>
</access-log>

And the access log will have the following in the first line.

root[sh]@julie# head -1 access


format=%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status%
%Req->srvhdrs.content-length% - %Req->headers.x-forwarded-for%

Steps for Oracle iPlanet Web Server 6.1:

1. Login to the Admin Server GUI.

2. Choose the server instance and click Manage button.

3. Click on the Logs tab.

4. Click the "Access Log Preferences" link on the left.

5. Under Format section, check the radio button next to "custom format" and add the following to the logging format (see below
screen shot).

%Req->headers.x-forwarded-for%

Note: you have to use lower cases of the header name.

6. Click OK. You would get a same warning table as above.

You have two options here:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=240829430714091&parent=EXTERNAL_SEARCH&sourceId=HOWTO&id=… 2/3
6/25/2019 Document 1403073.1

1) Click cancel to return to previous page to change the access log File Location, Or

2) Click OK to use the existing file location for the access log. Note: If you choose this option, you would need delete the
access file after having backed it up so that a new access file will be created upon restart of the server, and the new access log
will have the new logging format in the first line.

7. Click Apply to apply the change.

The magnus.conf file will have the following after the change:

Init fn="flex-init" access="$accesslog" format.access="%Ses->client.ip% - %Req->vars.auth-user%


[%SYSDATE%] \"%Req->reqpb.clf-request%\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% -
%Req->headers.x-forwarded-for%"

And the access log file has the following in the first line:

root[sh]@julie# head -1 access


format=%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status%
%Req->srvhdrs.content-length% - %Req->headers.x-forwarded-for%

To test if the change has taken effect, run the following:

root[sh]@julie# telnet localhost 80


Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /test.txt http/1.1
Host: julie
X-Forwarded-For: 1.2.3.4

HTTP/1.1 200 OK
Server: Sun-ONE-Web-Server/6.1
Date: Tue, 31 Jan 2012 23:35:02 GMT
Content-length: 13
Content-type: text/plain
Last-modified: Mon, 14 Nov 2011 18:19:46 GMT
Etag: "d-4ec15bc2"
Accept-ranges: bytes

TEST!
^CConnection to localhost closed by foreign host.

root[sh]@julie# cat access


format=%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] "%Req->reqpb.clf-request%" %Req->srvhdrs.clf-status%
%Req->srvhdrs.content-length% - %Req->headers.x-forwarded-for%
192.168.100.3 - - [31/Jan/2012:18:35:02 -0500] "GET /test.txt http/1.1" 200 13 - 1.2.3.4

Didn't find what you are looking for? Ask in Community...

Attachments
screenshot01.gif (14.97 KB)
screenshot02.gif (10.59 KB)
screenshot03 (26.36 KB)

Related
Products

Middleware > Application Servers > GlassFish Server > Oracle iPlanet Web Server > Log

Keywords
ADDRESS; ADMIN SERVER; IP ADDRESS; LOG FILE; LOGGING; LOWER CASE; ORACLE IPLANET WEB SERVER; SERVER.XML
Errors
HTTP-200

Back to Top
Copyright (c) 2019, Oracle. All rights reserved. Legal Notices and Terms of Use Privacy Statement

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=240829430714091&parent=EXTERNAL_SEARCH&sourceId=HOWTO&id=… 3/3

S-ar putea să vă placă și