Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #140 from dabelenda/fix_xforwardedfor
Browse files Browse the repository at this point in the history
[WIP] - Fix the remote client IP.
  • Loading branch information
lboatto authored Dec 7, 2017
2 parents 07be8ac + 7c226a0 commit fb4deb4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions build/httpd/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -e
cat > /etc/apache2/conf-available/dyn-vhost.conf <<EOF
UseCanonicalName Off
SetEnvIf X-Forwarded-For "^(.*\..*\..*\..*)|(.*:.*:.*:.*:.*:.*:.*:.*)" proxied
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
LogFormat "%V %{X-Forwarded-For}i %l %u %t \"%r\" %s %b" vproxy
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vcommon env=!proxied
CustomLog "/dev/stdout" vcommon env=!proxied
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vproxy env=proxied
CustomLog "/dev/stdout" vproxy env=proxied
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 172.31.0.0/16 10.180.21.0/24
LogFormat "%V %a %l %u %t \"%r\" %s %b %{ms}T" vcommon
CustomLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/access_log.%Y%m%d 86400" vcommon
CustomLog "/dev/stdout" vcommon
ErrorLog "| /usr/bin/rotatelogs /srv/${WP_ENV}/logs/error_log.%Y%m%d 86400"
VirtualDocumentRoot "/srv/${WP_ENV}/%0/htdocs"
Expand All @@ -33,6 +33,7 @@ EOF
/usr/sbin/a2enmod ssl
/usr/sbin/a2enmod rewrite
/usr/sbin/a2enmod vhost_alias
/usr/sbin/a2enmod remoteip
/usr/sbin/a2enconf dyn-vhost

/usr/sbin/apache2ctl -DFOREGROUND

0 comments on commit fb4deb4

Please sign in to comment.