Skip to content

Instantly share code, notes, and snippets.

@wstrange
Created September 20, 2011 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wstrange/1230591 to your computer and use it in GitHub Desktop.
Save wstrange/1230591 to your computer and use it in GitHub Desktop.
Proxy Pass Example
# Example Apache config to reverse proxy /ui to a back end app
# Also uses LDAP authentication on /ui and sets the REMOTE_USER header to the uid
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyHTMLLogVerbose On
ProxyHTMLURLMap http://localhost:9010 /ui
<Location /ui/>
AuthType Basic
AuthBasicProvider ldap
AuthName "LDAP test - login"
AuthLDAPURL "ldap://localhost:1389/ou=People, dc=example,dc=com?uid"
Require valid-user
AuthLDAPRemoteUserAttribute uid
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule .* - [E=RU:%1]
RequestHeader set REMOTE_USER %{RU}e
</Location>
ProxyPreserveHost On
ServerName www.fdemo.com
ProxyPass /ui http://127.0.0.1:9010/ui
ProxyPassReverse /ui http://127.0.0.1:9010/ui
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment