Skip to content

Oracle Cloud: Pass through actual client IP from Load Balancer to backend

In Oracle Cloud, you can pass through the actual client IP from a load balancer by configuring the load balancer to use the “Client IP” option for the “IP Mode” setting.

Here are the steps that we followed to configure the load balancer to pass through the actual client IP:

Log in to the Oracle Cloud Console.

Navigate to the Load Balancing service.

Select the load balancer that you want to configure.

Create Rule Set:

Use:

CLIENTIP

{X-Forwarded-For}

Monitor the work requests for rule set to update and when rule set update is over then move forward.

Next Modify the Listener:

Monitor the work requests until it completes.

 

Next, you will need to modify the “LogFormat”in the httpd.conf on the webserver so that it start writing the incoming header value to the access log

It should be something like the below:

Changing from

LogFormat “%h %l %u %t \”%r\” %>s %b”

to below

LogFormat “%{X-forwarded-for}i %l %u %t \”%r\” %>s %b”

In case you are using Oracle EBS then you can modify the below file in both RUN and PATCH editions:

$FMW_HOME/webtier/instances/<s_ohs_instance>/config/OHS/EBS_web/httpd.conf

CHANGE:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

TO BELOW:

LogFormat "%{X-forwarded-for}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%{X-forwarded-for}i %l %u %t \"%r\" %>s %b" common

 

 

 

Brijesh Gogia
Leave a Reply