Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save algotrader-dotcom/6a0488d212330c9b6294 to your computer and use it in GitHub Desktop.
Save algotrader-dotcom/6a0488d212330c9b6294 to your computer and use it in GitHub Desktop.
Apache reverse proxy basic authentication with whitelist IPs
## This conf will basic auth for all exept IP from graph.facebook, twitter..
<VirtualHost IP:443>
ServerName webapp.com
UseCanonicalName Off
ErrorLog /etc/httpd/logs/ssl_reverse_error_log
CustomLog /etc/httpd/logs/ssl_reverse_access_log combined env=!dontlog
RewriteLog "/etc/httpd/logs/ssl_rewrite.log"
RewriteLogLevel 3
<Proxy *>
AuthType Basic
AuthName "Please Log In"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
Order deny,allow
Deny from all
Allow from 127.0.0.1, 58.64.198.68, 58.64.198.94, 61.160.209.167, 173.0.82.77, 110.75.146.31, 134.170.104.40, 31.13.95.8, 104.244.42.130
Satisfy any
</Proxy>
RewriteEngine On
SSLProxyEngine on
ProxyVia Block
ProxyRequests Off
ProxyPass / https://backend-java-app:9002/
ProxyPassReverse / https://backend-java-app:9002/
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment