Skip to content

Instantly share code, notes, and snippets.

@wstrange
Created September 20, 2011 22:18
Show Gist options
  • 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 apche config to reverse proxy /ui to a back end app
# Also used 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>
<Directory /var/www/ldap>
AuthType Basic
AuthBasicProvider ldap
AuthName "LDAP test login with uid"
AuthLDAPURL "ldap://localhost:1389/ou=People, dc=example,dc=com?uid"
Require valid-user
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
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