Rando Hinn
Rando Hinn

Reputation: 1322

Proxied URL basic auth redirect path

So, say I have a proxied url whatever.com that actually is proxied to show content from whatever.mydomain.com. whatever.mydomain.com then has a basic auth directory

<Directory /var/www/html/stuffs/internal>
      AuthType Basic
        AuthName "mumbo-jumbo"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>

When the user hits whatever.com/internalthe login form is displayed, but after logging in, they get sent to whatever.mydomain.com/internalfor the content. How could I keep it so that after the login, the user is sent to the proxy url aswell? Or atleast make it seem so to the end user?

Upvotes: 1

Views: 79

Answers (1)

Gen
Gen

Reputation: 178

It can we solved by putting RewriteRule after Directory.

<Directory />
  AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
</Directory>
RewriteCond %{LA-U:REQUEST_URI} !^$
RewriteRule ^/(.*) http://whatever.mydomain.com/$1   [P,L]

Upvotes: 1

Related Questions