MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Tips and Tricks => Topic started by: LotsOfQ on 2015-05-30, 18:47:43

Title: Nginxproxy 127.0.0.1
Post by: LotsOfQ on 2015-05-30, 18:47:43
I am running nginxproxy. I googled and found out that apps like prosper202 that log ip are not able to but instead get 127.0.0.1. Is there anyway to fix this?
Title: Re: Nginxproxy 127.0.0.1
Post by: MRatWork on 2015-05-30, 22:50:27
Nginx-proxy mean nginx in front and httpd (apache) in backup where php processed by httpd. So, application didn't nginx but httpd.
Title: Re: Nginxproxy 127.0.0.1
Post by: LotsOfQ on 2015-05-31, 04:32:39
I didn't realized that 2 of my applications after I switch to nginx-proxy all the ip now logged as 127.0.0.1 instead of the actual visitor's ip. I switch back to Apache then the apps logged normal visitor's ip again.

I also found this from prosper202 forum but have no idea what it means. But this is what lead me to realize it's nginx-proxy issue.

Quote

hey, sorry if this was posted before -- I searched and couldn't find anything

I'm runing p202 behind a reverse proxy and when tracking visitor IP it only shows 127.0.0.1 (which is the IP of the reverse proxy which is on the same host). It's basically an Nginx proxies to Apache type of thing.

Now, Nginx does forward the original ip in the HTTP_X_FORWARDED_FOR header but how do I get P202 to read that? Is there an elegant solution or should I just hack that in?
Title: Re: Nginxproxy 127.0.0.1
Post by: MRatWork on 2015-05-31, 08:09:05
It's prosper202 issue rather than nginx-proxy. No issue for wordpress as I know.
Title: Re: Nginxproxy 127.0.0.1
Post by: LotsOfQ on 2015-06-02, 09:52:54
I also have another application that log user ip and it does the same thing. It logged 127.0.0.1 for user's ip. The same thing is true if I switch back to Apache then it works as normal.
Title: Re: Nginxproxy 127.0.0.1
Post by: MRatWork on 2015-06-02, 12:12:16
It's related to applications issue rather than nginx-proxy itself.

Application must read 'HTTP_X_FORWARDED_FOR' if exists instead 'REMOTE_ADDR'.