How to setup apache reverse proxy for particular domain

111 views Asked by At

I have some app installed on appname.com and I am using apache proxy server. Both are on different servers.

When user tries to access website appname.com I want to do Basic Authentication using proxy and if he completes authentication I want to send his username in headers to appname.com which is on different server than proxy

I have done similar thing for myproxy.com/appname location with below working solution.

ProxyPass /appname http://appname.com
ProxyPassReverse /wordpress http://appname.com

<Location /appname>
    AuthType Basic
    AuthName "Restricted Files"
    # (Following line optional)
    AuthBasicProvider file
    AuthUserFile /home/tomcat/apache/.htpasswd
    Require valid-user

    RewriteEngine on
    RewriteRule .* - [E=RU:%{REMOTE_USER}]
    RequestHeader set X-Forwarded-User %{REMOTE_USER}s
</Location>

I want same solution for domain appname.com instead of location /appname. I tries with VirtualHost but not able to do it as appname.com is on different server than proxy.

Any hint for that? Thanks.

0

There are 0 answers