On Apr 23, 2:16 pm, Virtual Dust <[EMAIL PROTECTED]> wrote: > Eirik Schwenke wrote: > > I just now tested with the following in my local apache-config: > > > ~ <LocationMatch "/[^/]+/login$"> > > ~ AuthType Basic > > ~ AuthName "Projects" > > ~ AuthUserFile /home/httpd/trac-env/trac.htpasswd > > ~ Require valid-user > > ~ </LocationMatch> > > > And it demanded login-credentials for all /foo/bar/login-urls i threw at it. > > > (Note the trailing $ didn't make any difference wrt wether or not the > > section > > worked, but it's best to be reasonably specific about > > LocationMatch-directives, > > in case they're included in a complex apache-config). > > > I'd double-check my apache-config for typos and see if the apache error.log > > has > > anything helpful to add -- because as far as I can understand the code you > > posted earlier *should* work. > > Let's do some magics... > > ~ DocumentRoot /home/httpd/projects > ~ > ~ <Location /> > ~ SetHandler mod_python > ~ PythonHandler trac.web.modpython_frontend > ~ PythonOption TracEnvParentDir /home/httpd/trac-env > ~ PythonOption TracUriRoot / > ~ SetEnv PYTHON_EGG_CACHE /home/httpd/.egg-cache > ~ PythonDebug On > ~ </Location> > ~ > ~ <LocationMatch "/[^/]+/login$"> > ~ AuthType Basic > ~ AuthName "Projects" > ~ AuthUserFile /home/httpd/trac-env/trac.htpasswd > ~ Require valid-user > ~ </LocationMatch> > > This is the initial configuration : i'm not asked for authentication > forhttp://projects.arcanes.home/foo/login > > Now... > > ~ DocumentRoot /home/httpd/projects > ~ > * <Directory /home/httpd/projects/> > ~ SetHandler mod_python > ~ PythonHandler trac.web.modpython_frontend > ~ PythonOption TracEnvParentDir /home/httpd/trac-env > ~ PythonOption TracUriRoot / > ~ SetEnv PYTHON_EGG_CACHE /home/httpd/.egg-cache > ~ PythonDebug On > * </Directory> > ~ > ~ <LocationMatch "/[^/]+/login$"> > ~ AuthType Basic > ~ AuthName "Trac Projects Authentication" > ~ AuthUserFile /home/httpd/trac-env/trac.htpasswd > ~ Require valid-user > ~ </LocationMatch> > > (changed lines start with *) > And... All is fine !! > > It seams that the Apache server deals with the <Location /> directive in > a particular way. I don't know if it's a bug (just in my version ?), > though. Maybe there is a real reason for that.
But what is in '/home/httpd/projects/'? Letting it fall back on to document root like this may itself cause problems if not careful depending on whether document root is empty or not. Frankly, how mod_python hooks into Apache is a PITA as it causes various little oddities where the true target of a request as calculated by Apache, ie.,. SCRIPT_NAME equivalent, ends up being wrong. End result is that web applications have learned not to trust what mod_python passes it for some values in the request and applications work it out themselves from the request URI. This means though that the applications have to be told where the application is mounted if not mounted at root. In contrast, mod_wsgi hooks into Apache in a more traditional resource based approach like CGI configuration is done. This means SCRIPT_NAME is correct and you don't end up with these funny little problems like you are having when using Location directive to try and configure mod_python. In other words, you might consider looking at mod_wsgi instead of mod_python as it doesn't generally exhibit these odd little issues that mod_python sometimes can. :-) Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---