Slashes in URL are changed to forward slashes for no reason?

php

#1

I have a PHP workspace, where there is a URL like this: https://blah-blah.c9users.io/index.php?ctrl=Installer\Controllers\SelectLanguage

But in the logs, I can see “GET /index.php?ctrl=Installer/Controllers/SelectLanguage HTTP/1.1”. The slashes in the ctrl parameter value have been changed to forward slashes.

It works fine in my local and my web server. This strange behaviour only happens in Cloud9. Any idea how to fix it?

Cheers,


#2

It sounds like the HTTP proxy Cloud9 uses might be changing the slashes before it reaches your server. If that’s the case, then I’m not aware of a good solution, maybe @moderators can help?


#3

Thank Danny. How does this proxy work? I found that it seems there is a different IP address on every pageview which is kind of breaking some of my validation logic that assumes visitors would stay on the same IP address during a visit.


#4

We traced the issue to a bug in nodejs url module.
Will fix it soon.


#5

Thanks, please let me know once the bug is fixed.

Regarding to the IP address, is there anyway to work around it so the server can see my actual IP address or at least it won’t be changed randomly for every page view?


#6

how do you detect the ip address?
I think x-forwarded-for header should stay the same, but the actual connection ip can’t stay the same, since it is the ip of the proxy server, and the load balancer picks the one that is free.


#7

I am using $_SERVER[‘REMOTE_ADDR’] to detect IP address


#8

That doesn’t work when running behind a proxy see

https://stackoverflow.com/a/2031935/1743328