Question

Client IP on App Platform

Hi,

Firstly thanks for all the great community resources here 👍

I’ve been testing out the App Platform with a Docker container that hosts an Apache server. I was wondering what would be the correct way to configure it such that it reports the correct client IP as opposed to the load balancer IPs (I’m assuming that’s the IP I’m seeing)?

I read through this related question which was really useful.

From a quick test, I can see the X-Forwarded-For and DO-Connecting-IP are populated in the headers and contain the client IP.

Setting RemoteIPHeader X-Forwarded-For on it’s own doesn’t do the trick sadly. Reading further through the docs of mode_remoteip it seems in order for this work a list of trusted proxy IP addresses is needed.

e.g. RemoteIPTrustedProxy 141.101.64.0/18

Is there a stable set hostnames or IP ranges that can be used? Is there perhaps a more correct way of achieving this on App Platform?

Thanks!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

njw
DigitalOcean Employee
DigitalOcean Employee badge
October 20, 2021
Accepted Answer

Hey there!

The DO_Connecting-IP header should actually contain the connecting IP address of the client. This header would be used to obtain that information.

DO_Connecting-IP

Hope it helps! Nate

In case anyone that is using php on the app platform finds this

This server var is prefixed with HTTP_

$_SERVER['HTTP_DO_CONNECTING_IP']

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.