dmikusa / cf-php-apache-buildpack

CloudFoundry PHP & Apache HTTPD Buildpack
Apache License 2.0
4 stars 11 forks source link

$_SERVER['REMOTE_HOST'] and REMOTE_ADDR incorrectly set #7

Open gberche-orange opened 10 years ago

gberche-orange commented 10 years ago

As HTTP traffic for the apps on CloudFoundry are served by a chain[1], then the X-FORWARDED-HOST and X-FORWARDED-PROTO headers should be used to properly fill the $_SERVER variable for php apps.

Currently php apps most likely see the gorouter IP in REMOTE_X variables, and the DEA IP and port into SERVER_PORT and SERVER_ADDR

https://php-info.cfapps.io/info.php _SERVER["REMOTE_ADDR"] 10.10.16.16 _SERVER["REMOTE_PORT"] 14456

[1] Current request chain is:

dmikusa commented 10 years ago

This definitely needs addressed. After I finish my current task, which is restructuring the build pack, I will add in support for this.

My plan is to use mod_remoteip since it's a core module and it will sufficiently address the remote address issue.

I do not plan to address the remote port though, unless there is a good reason. Have you encountered issues with this? I don't believe that the Java build pack resets the remote port. It just fixes the ip address and protocol.

gberche-orange commented 10 years ago

Thanks. Sorry about the confusion, indeed there is no such X-FORWARDED-PORT header. Editing that into the original issue title

SalvadorBR commented 8 years ago

Good Morning,

I'm a page web in WordPress a I need use de httpd protocol, The core of WorPress use variables like $_SERVER[HTTP_X_FORWARDED_PROTO] and $_SERVER['HTTPS'] to process redirections.

After read this issue I would like that in my server apache show the variables like this example https://php-info.cfapps.io/info.php, so my question is: how can I activate the group of variables like _SERVER["HTTP_X_FORWARDED_PROTO] and that I can show when I run phpinfo().

Thanks a lot.