0

So... i've been really struggling with this one, because it absolutely doesn't make any sense to me, but without further delays...

I'm running two servers, one on IIS, the other is Linux:
Server1 = IIS
Server2 = Linux (centos)

I've created a rewrite rule (ReverseProxy) from Server1 to Server2, so:
www.example.com/dir/ -> dir.example.com

RewriteCond %{HTTP:Host} ^(?:www.)?example.com$
RewriteCond %{REQUEST_URI} ^/dir/(.*)
RewriteProxy dir(.+) http\://dir.example.com/$1 [I,U]

Everything works perfectly to this point.

But what i'm trying to do, is lock one of the folders on Server2 with an .htpasswd (dir.example.com/restricted/) and this is where things are getting messy....

When i enter from:
dir.example.com/restricted/ the auth window shows and i'm prompted for a username and password. and it works fine.

but when i enter from:
www.example.com/dir/restricted/ the auth window shows, i'm prompted for a username/password, but when i enter the same user credentials, it doesn't work, i'm being prompted again.

This is my .htaccess for the restricted folder:

AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/var/www/html/restricted/.htpasswd"
Require valid-user

And the .htpasswd was created using the console.

If anyone has an idea or experience with the subject, i'd really appreciate it!
Because i'm really stuck here....

Best regards, Hanan.

Hanan
  • 11
  • 2
  • What browser are you using? What do access/error logs from server2 say? What kind of redirect are you using? What does your browser debugger (firebug/dragonfly/chrome debugger/...) say? – Konerak Oct 27 '11 at 13:13
  • i'm using chrome. the error logs are showing an error when supplying incorrect credentials on Server2, but when going through www.example/dir/restricted i don't get any errors. what kind of redirect? i added the information to my original post. where/how should i check? – Hanan Oct 27 '11 at 14:42

0 Answers0