Redirect WTF
"David E. Wheeler" <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Fellow mod_perlers,
Here's a weird one for you. I'm testing Bricolage on mod_perl 2, getting it ready for release, and noticed that some sort of redirect is happening when I don't expect it.
To whit, I have this configuration:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /usr/local/bricolage/comp
ServerName benedict.local
DefaultType "text/html; charset=utf-8"
AddDefaultCharset utf-8
SetHandler modperl
PerlResponseHandler Bric::App::Handler
PerlAccessHandler Bric::App::AccessHandler
PerlCleanupHandler Bric::App::CleanupHandler
PerlOptions +GlobalRequest
RedirectMatch permanent .*\/favicon\.ico$ http://benedict.local/media/images/bricicon.ico
TraceEnable off
PerlTransHandler Bric::App::PreviewHandler::uri_handler
<Location /logout>
PerlAccessHandler Bric::App::AccessHandler::logout_handler
PerlCleanupHandler Bric::App::CleanupHandler
</Location>
<Location /login>
SetHandler modperl
PerlAccessHandler Bric::App::AccessHandler::okay
PerlResponseHandler Bric::App::Handler
PerlCleanupHandler Bric::App::CleanupHandler
</Location>
<Location /media>
SetHandler default-handler
PerlAccessHandler Apache2::Const::OK
PerlCleanupHandler Apache2::Const::OK
</Location>
<Location /media/js>
ForceType "text/javascript; charset=utf-8"
</Location>
<Location /media/css>
ForceType "text/css"
</Location>
<Location /data>
SetHandler default-handler
</Location>
<Location /soap>
SetHandler modperl
PerlResponseHandler Bric::SOAP::Handler
PerlAccessHandler Apache2::Const::OK
</Location>
<Location /dist>
SetHandler modperl
PerlResponseHandler Bric::Dist::Handler
</Location>
<Location /data/preview>
ExpiresActive On
ExpiresDefault "now plus 0 seconds"
PerlFixupHandler Apache2::Const::OK
</Location>
</VirtualHost>
Note that the hosthame is "benedict.local". Now I often just use localhost when using Bricolage, and most of the time that works fine. But there is one JavaScript-triggered redirect button that looks like this:
window.location.href = '/admin/profile/dest?id=1024'
And when I click it, The request goes to mod_perl and I see it come through the access handler and the fixup handler as a request to localhost. But then the PerlReponseHandler never fires! Instead, I see another request come in for the same URL path, but this time for the host name benedict.local. It's almost as if something in Apache or mod_perl is seeing that the request is for a different domain name and helpfully trying to redirect. But it's not helpful (I get a new login screen), and I don't understand why the same thing doesn't happen for other requests.
Is there something like that in mod_perl2 and I'm just missing it? Or is it more likely that there's some other mysterious bit of code in Bricolage that's doing it and I just haven't found it yet? If the latter, what comes between the PerlFixupHandler and PerlResponseHandler? Because in that first request, the fixup handler fires but the response handler never does.
TIA,
David