我在windows上configuration了apache-2.4作为我的内部nginx服务器的反向代理(我知道!但是不要问我为什么!!)。 几乎一切都很好,除了:
我相信我已经configurationnginx使用这个头来logging真实的IP: X-Real-IP 。 参考 。 现在在我的反向代理中,我该如何设置这个头部到客户端的IP地址,以便它可以被logging。 请注意,SSL是apache-2.4上的必备工具。 目前我的http-vhosts.conf有这个:
<VirtualHost _default_:443> RequestHeader set X-Forwarded-Proto "https" RequestHeader set X-Forwarded-Ssl on RequestHeader set X-URL-SCHEME https ServerName www.external.gateway:443 ServerAlias external.gateway:443 ErrorLog "C:/Apache24/logs/gateway-error.log" CustomLog "C:/Apache24/logs/gateway-access.log" common # ServerAdmin [email protected] SSLEngine On SSLCertificateFile C:/Apache24/ssl/external.gateway.crt SSLCertificateKeyFile C:/Apache24/ssl/external.gateway.key <Location /> SSLRequireSSL </Location> ProxyPreserveHost On ProxyPass / http://internal.nginx:80/ ProxyPassReverse / http://internal.nginx:80/ </VirtualHost>
PS:我可以在nginx中使用X-Forwarded-For ,但是我需要知道如何在apache httpd.conf中设置这个头文件。 任何帮助表示赞赏。
信贷给伍尔特
在httpd.conf中的Apache httpd(反向代理)中启用mod_proxy_http ,如下所示:
LoadModule proxy_module modules / mod_proxy.so
LoadModule proxy_http_module modules / mod_proxy_http.so
如前所述,使用X-Forwarded-For在nginx(上游)中loggingIP