LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-03-2017, 10:08 AM   #1
athreyavc
Member
 
Registered: May 2004
Location: bangalore
Distribution: Cent OS, Ubuntu
Posts: 116

Rep: Reputation: 15
centos7 Apache/2.4.6 - mod_remoteip Not working


Hi,

I am running a centos7 and apache server (httpd)
Code:
apachectl -V
[Mon Apr 03 16:01:54.213096 2017] [so:warn] [pid 55106] AH01574: module remoteip_module is already loaded, skipping
[Mon Apr 03 16:01:54.213235 2017] [so:warn] [pid 55106] AH01574: module remoteip_module is already loaded, skipping
Server version: Apache/2.4.6 (CentOS)
Though remote_ip module is installed it doesn't seem to work. I have a PHP script from in which I need to record the HTTP_X_REAL_IP.

I am getting

Code:
PHP Notice:  Undefined index: HTTP_X_REAL_IP
This webserver is behind an Haproxy server and I have set on HAPROXY

Code:
option forwardfor header X_REAL_IP
On the CentOS webserver, /etc/httpd/conf.modules.d/360_mod_remoteip.conf
Code:
LoadModule remoteip_module modules/mod_remoteip.so
RemoteIPTrustedProxy 192.168.10.43
RemoteIPHeader X-Forwarded-For
RemoteIPHeader X-Real-IP
But it just doesn't seem to work.

Any help is really appreciated.

Regards,
 
Old 04-04-2017, 04:30 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Installed, but did you enable it?
Code:
a2enmod remoteip
likely needs a service restart also.
 
Old 04-04-2017, 04:41 AM   #3
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Habitual View Post
Installed, but did you enable it?
Code:
a2enmod remoteip
likely needs a service restart also.
CentOS doesn't use a2enmod, that I believe is a Ubuntu/Debian specific thing. It would be best to confirm with either of the following

Code:
[root@Web1 ~]# httpd -M | grep "remote"
 remoteip_module (shared)
[root@Web1 ~]# apachectl -M | grep "remote"
 remoteip_module (shared)
remoteip is a default in the CentOS/RHEL supplied apache build anyways.

Code:
# yum provides /etc/httpd/modules/mod_remoteip.so
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
httpd-2.4.6-40.el7.centos.1.x86_64 : Apache HTTP Server
Repo        : @updates
Matched from:
Filename    : /etc/httpd/modules/mod_remoteip.so
More details on how it isn't working may help.

Last edited by r3sistance; 04-04-2017 at 04:49 AM.
 
1 members found this post helpful.
Old 04-04-2017, 11:16 AM   #4
athreyavc
Member
 
Registered: May 2004
Location: bangalore
Distribution: Cent OS, Ubuntu
Posts: 116

Original Poster
Rep: Reputation: 15
Hi,

Thanks for the Replies

It seems the apache 2.4 doesn't support HEADERS with UNDERSCORE in them. This I got from the link below,

http://geekyschmidt.com/2016/03/23/a...th-underscores


Quote:
Starting with Apache 2.4, headers were dropped that contained items to include underscores and expects dashes instead. Red Hat backported this change into the Apache 2.2 that ships with 6.7. You can read more here:https://httpd.apache.org/docs/2.4/env.html
I applied that fix and it is working for me now.

Regards,
 
Old 09-11-2018, 10:57 AM   #5
loping
LQ Newbie
 
Registered: Sep 2018
Posts: 3

Rep: Reputation: Disabled
Cool

the above link is moved. try http://geekyschmidt.com/techie/2016/...derscores.html now
 
Old 09-11-2018, 05:09 PM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Cloudflare? They have some dox on this thing:
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH not working properly on centos7 sigint-ninja Linux - Newbie 7 07-11-2016 07:40 PM
javac not working on my centos7 install sigint-ninja Linux - Newbie 2 07-10-2016 12:14 PM
usb speakers not working on centos7 sigint-ninja Linux - Newbie 2 07-09-2016 10:52 AM
CentOS7 / Apache / custom DocumentRoot / SELinux issue AdultFoundry Linux - Server 1 01-08-2016 09:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration