Answer the question
In order to leave comments, you need to log in
Apache 2.4 does not see external IP even though mod_remoteip is configured. Where to dig?
Colleagues, good afternoon.
Prompt, please, in what there can be a business. The second day I fight.
Briefly: There are two identical servers, Apache sees the client's IP on one, and does not see it on the other.
In detail:
There is a test web server on openSUSE Leap 15. It is running apache 2.4.33, nginx 1.14.2 and related software.
The nginx config says:
proxy_set_header HTTPS YES;
proxy_set_header Host $host:443;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Server-Address $server_addr;
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 10.1.1.10
RemoteIPInternalProxy 127.0.0.1 10.1.1.10
</IfModule>
# apache2ctl -M | grep remote
remoteip_module (shared)
Order allow,deny
Allow from 10.1.1.11
Allow from 10.1.1.12
Deny from all
<?php
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
exit;
?>
Answer the question
In order to leave comments, you need to log in
Change the order of directives in apache, first RemoteIPInternalProxy, after RemoteIPTrustedProxy:
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1 10.1.1.10
RemoteIPTrustedProxy 127.0.0.1 10.1.1.10
</IfModule>
RemoteIPHeader X-Forwarded-For shouldn't be X-Real-IP case?
RemoteIPHeader Directive / Declare the header field which should be parsed for useragent IP addresses
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question