Trac doesn't work with Virtual Hosts - Authentication information not available

199 views
Skip to first unread message

Marc

unread,
Aug 1, 2009, 10:56:55 PM8/1/09
to Trac Users
Here is my VirtualHost configuration

<VirtualHost *:80>
ServerName myproject.host.com
# We can't use Location / because then /login also gets sent to
mod_python
<Location />
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/trac/myproject/
PythonOption TracUriRoot /
SetEnv PYTHON_EGG_CACHE /var/trac/.egg-cache/
</Location>

<Location /login>
AuthType Basic
AuthName "Trac (Subversion) access"
AuthUserFile /etc/apache2/svn.passwd
Require valid-user
</Location>
</VirtualHost>

The problem is that the Login location does not work. Trac' (NOT
mod_python), hijacks everything and sends it to itself. Even setting
SetHandler None in <Location /login> does nothing.

The famous "Authentication information not available" message appears.
Apache never is able to handle the <Location /login>, Trac hijacks it.

Has anybody ever solved this long-standing issue? It seems to be a
problem with Trac, because other mod_python apps like Django use the
SetHandler None solution and it works fine.

Using DocumentRoot does no difference whatsoever.

Thanks.

Erik Bray

unread,
Aug 3, 2009, 4:54:45 PM8/3/09
to trac-...@googlegroups.com

If I understand correctly, you *want* Trac to handle /login. Trac has
a request handler for /login that handles generating the Trac cookie
if authentication information is provided by the server. Otherwise
Apache is just authenticating /login and then doing nothing at that
location.

Marc

unread,
Aug 4, 2009, 6:28:36 AM8/4/09
to Trac Users
Yes the problem is that apache is not prompting the login form in /
login. It just goes straight to Trac.

I have fixed it now, I've set the logging level to debug and saw this

[Tue Aug 04 03:21:06 2009] [debug] mod_deflate.c(632): [client myip]
Zlib: Compressed 4133 to 1507 : URL /include/error.php, referer:
http://myproject.url.com/

I removed this line from my apache conf:

ErrorDocument 401 /include/error.php?401

It was my custom error handler.

What I did now is set: ErrorDocument 401 default inside the <Location /
login>

Everything works now, anybody able to explain the mechanism behind the
401 with Trac?

Thanks!

On Aug 3, 1:54 pm, Erik Bray <hyugaricd...@gmail.com> wrote:

Marc

unread,
Aug 4, 2009, 6:33:15 AM8/4/09
to Trac Users
Here is the Trac bug for future reference. They did the same solution
as me.

http://trac.edgewall.org/ticket/2371

Erik Bray

unread,
Aug 4, 2009, 6:51:25 PM8/4/09
to trac-...@googlegroups.com
On Tue, Aug 4, 2009 at 6:28 AM, Marc<santu...@gmail.com> wrote:
>
> Yes the problem is that apache is not prompting the login form in /
> login. It just goes straight to Trac.
>
> I have fixed it now, I've set the logging level to debug and saw this
>
> [Tue Aug 04 03:21:06 2009] [debug] mod_deflate.c(632): [client myip]
> Zlib: Compressed 4133 to 1507 : URL /include/error.php, referer:
> http://myproject.url.com/
>
> I removed this line from my apache conf:
>
> ErrorDocument 401 /include/error.php?401
>
> It was my custom error handler.
>
> What I did now is set: ErrorDocument 401 default inside the <Location /
> login>
>
> Everything works now, anybody able to explain the mechanism behind the
> 401 with Trac?
>
> Thanks!

Simpler: Put a '#' in front of the 'ErrorDocument 401' line :)

Reply all
Reply to author
Forward
0 new messages