-
Notifications
You must be signed in to change notification settings - Fork 14
Reverse proxy with authentication on apache2
Anders Nylund edited this page Aug 13, 2015
·
5 revisions
An apache reverse proxy for pellmon on ip 192.168.1.101:8081, with basic authentication added can look something like this:
<Location /pellmon>
ProxyPass http://192.168.1.101:8081/pellmon
ProxyPassReverse http://192.168.1.101:8081/pellmon
AuthType Basic
AuthName "PellMon"
AuthUserFile /etc/pellmon/pwd
AuthBasicProvider file
require valid-user
</Location>
<Location /pellmon/websocket>
require all granted
ProxyPass ws://192.168.1.101:8081/pellmon/websocket
ProxyPassReverse ws://192.168.1.101:8081/pellmon/websocket
</Location>
You need to have the apache modules proxy_http
and proxy_wstunnel
enabled.
In this configuration PellMon is configured with a webroot of /pellmon to allow for other sites on apache.
[conf]
port = 8081
webroot = /pellmon
Create the password file (AuthUserFile) with htpasswd
An exeption to the authentication is added for the websocket path because some browsers doesn't handle authentication on websockets.
(This works for me on apache 2.4.7, the proxy_wstunnel module is only available on quite recent apache versions)