Page 1 of 1

Reverse Proxy and IPs: Remove or modify?

Posted: Sat Jan 09, 2016 11:30 pm
by ninespire
Hello. I've been working on my server lately and I've noticed that all visitors are under the same IP address, the server's IP. I looked up what was the problem, and I've seen that it's nginx being used as a reverse proxy.

The cons of removing this I've seen is slower load times for your websites, but I really want to ask, what would be the better route?

I've heard of installing libapache2-mod-rpaf, but to my surprise I found it already installed. I am definitely not seeing the visitors' IPs being forwarded to the forum script i'm using. I need to know the IPs of the visitors in case of the need to IP ban someone or stop spam by blocking a range of addresses.

If it is better to uninstall nginx in this circumstance, can someone help me with the steps to do that without damaging my installation of VestaCP?
And if not, can someone tell me how to configure the nginx server to forward visitors' IP addresses to the forum software i'm using?
Or is there a third option I do not know about here? Am I wrong about any of the information I've gathered?

Thanks for the help!

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Tue Jan 12, 2016 10:30 am
by skurudo
OS? Version?

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Tue Jan 12, 2016 4:22 pm
by LouisUK
I had the same issue on Ubuntu and I followed this post to fix it: viewtopic.php?f=10&t=6650#p20197

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Tue Jan 12, 2016 9:07 pm
by skurudo
In theory there is two ways:
- reactivate mod rpaf and check rpaf config
- use something else like remoteip

rpaf old and can be a problem in future with apache 2.4,
but in many debian/ubunbu still in apache repo... sad but true

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Tue Jan 12, 2016 10:02 pm
by ninespire
I'm running Ubuntu 15.04 on my web server. I just tried removing mod-rpaf and enabling remoteip.
I set my remoteip.conf as this:

Code: Select all

<IfModule mod_remoteip.c>
RemoteIPHeader X-Real-IP
RemoteIPInternalProxy 127.0.0.1
RemoteIPInternalProxy xxx.xxx.xxx.xxx // Public IP
</IfModule>
(I actually used the public IP of the webserver, I didn't just put the x's there.)

And when i restarted apache I got this error, all my websites gave me 500 internal server error.

Code: Select all

 * Restarting web server apache2                                         [fail]
 * The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 4 of /etc/apache2/mods-enabled/remoteip.conf:
RemoteIP: Error parsing IP // (The specified IP address is invalid. error) for RemoteIPInternalProxy
Action 'configtest' failed.
I removed that line with the public IP, and my websites were able to be viewed again, but still no IP passthrough.

Help?

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Fri Jan 15, 2016 9:51 pm
by skurudo

Code: Select all

RemoteIPInternalProxy 127.0.0.1 xxx.xxx.xxx.xxx 
Try this.

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Sat Jan 16, 2016 8:18 pm
by ninespire
That worked! You really saved me there. Thank you!

Re: Reverse Proxy and IPs: Remove or modify?

Posted: Tue Jan 19, 2016 2:03 pm
by skurudo
Nice ;-)
Have a nice day.