# Dev. Mode & Basic HTTP Authentication

**URL:** <https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846>\
**Category:** Radiant CMS\
**Created:** [May 10, 2007, 10:19pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846 "2007-05-10T22:19:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 10, 2007, 10:19pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/1 "2007-05-10T22:19:30Z")

</div>

Hi,

Hopefully someone can help me with this little problem.

I have set up a dev. domain to point at my regular mongrel cluster  
(used for the regular domain), but when adding basic authentication  
to limit the access using a simple name/pass - it isn’t getting  
picked up by apache2.

I have pointed the document root and directory of the virtual server  
elsewhere, and it picks up the authentication straight away.

I’m guessing that the rewrite rule to push the requests over to the  
mongrel\_cluster are taking precedence

I’m scratching my head on this, can anyone help? - it’s in the howto,  
so hopefully it’s something basic I’m not getting.

Cheers,

Dominic

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 13, 2007, 9:22pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/2 "2007-05-13T21:22:13Z")

</div>

> I have set up a dev. domain to point at my regular mongrel cluster  
> (used for the regular domain), but when adding basic authentication  
> to limit the access using a simple name/pass - it isn’t getting  
> picked up by apache2.
> 
> I have pointed the document root and directory of the virtual server  
> elsewhere, and it picks up the authentication straight away.
> 
> I’m guessing that the rewrite rule to push the requests over to the  
> mongrel\_cluster are taking precedence

This is a little late…but…

Did you try using the location directive to restrict access?

\<Location /intranet\>  
AuthType Basic  
AuthName “Intranet”  
AuthUserFile /etc/httpd/conf/http.users  
AuthGroupFile /etc/httpd/conf/http.group  
Require group my\_grp

This works for me with apache 2.0.x and mod\_proxy.

HTH,  
-Ryan Casey

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 13, 2007, 9:27pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/3 "2007-05-13T21:27:14Z")

</div>

Ryan’s method should work, but make sure that comes above your proxy  
rule. Apache is sensitive to the orders of certain things.

Sean

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 13, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/4 "2007-05-13T23:43:33Z")

</div>

Thanks for the reply - I didn’t - I was just using the directory  
directive … I guess location has a higher priority as it gets  
picked up whereas directory doen’t.

I have pretty much left it closed for now as it hasn’t been necessary  
to add. Although it would be a nice to allow the previewing of draft  
pages - whilst restricting access…

Please forgive my ignorance, but I don’t understand how restricting  
access to dev.site/path helps though, as people can still see  
dev.site/ - which is what I am trying to restrict…

Are you redirecting everything to be accessed via /path and then  
restricting that? If so how are you doing that just for the dev. site?

Thanks for your help - both of you.

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 14, 2007, 12:15pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/5 "2007-05-14T12:15:46Z")

</div>

Hmm, I’m not sure what you mean - I have two virtual hosts at the  
moment, one setup with www.site and one with dev.site - both  
redirecting to the mongrel\_cluster…

I’m going to be hosting many sites on this box so adding a location  
directive of / won’t work as it will restrict access to everything,  
and the directory directive doesn’t seem to get picked up before the  
redirect is implemented from the virtualhost directive. I think the  
virtualhost directive has a higher priority than the directory  
directive, so gets implemented before the directory directive…

Its not really a problem, as I don’t really need it right now, but it  
would be nice to know that it is possible with this type of setup.

Save connecting via different method I’m not sure what else is  
possible. Any help would be greatly appreciated.

Cheers

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 15, 2007, 4:06am UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/6 "2007-05-15T04:06:45Z")

</div>

> Hmm, I’m not sure what you mean - I have two virtual hosts at the  
> moment, one setup with www.site and one with dev.site - both  
> redirecting to the mongrel\_cluster…

I think what Sean was suggesting and what might work is inside your  
dev.site  
virtual host definition, add the directive and have the  
access  
permissions there.

For your www.site vhost directive, don’t include a Location restriction.

Thanks,  
-Ryan Casey

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 14, 2007, 12:17am UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/7 "2007-05-14T00:17:35Z")

</div>

Actually sounds like you need two virtual host. The “[dev.mysite.com](http://dev.mysite.com)”  
would have the added HTTP authentication, not a specific location or  
directory. You could still proxy to the same Mongrels inside the  
second virtual host.

Sean

---

<div class="post-metadata">

**Author:** ![dominic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://www.ruby-forum.com/u/dominic)\
**Post date:** [May 15, 2007, 2:32pm UTC](https://www.ruby-forum.com/t/dev-mode-basic-http-authentication/103846/8 "2007-05-15T14:32:55Z")

</div>

Thanks, I double triple checked my apache setup again and it turns  
out I was loading the include file with the config twice, once from  
inside the virtual host, and also before any virtual hosts were  
applied - hence the problem.

A stupid mistake I should have caught first time round… Apologies  
for taking up your time -and many thanks for helping me go over and  
check my setup properly.

Cheers
