Redirect WTF
am 26.01.2010 23:58:49 von david
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
DocumentRoot /usr/local/bricolage/comp
ServerName benedict.local
DefaultType "text/html; charset=3Dutf-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
PerlAccessHandler Bric::App::AccessHandler::logout_handler
PerlCleanupHandler Bric::App::CleanupHandler
SetHandler modperl
PerlAccessHandler Bric::App::AccessHandler::okay
PerlResponseHandler Bric::App::Handler
PerlCleanupHandler Bric::App::CleanupHandler
SetHandler default-handler
PerlAccessHandler Apache2::Const::OK
PerlCleanupHandler Apache2::Const::OK
ForceType "text/javascript; charset=3Dutf-8"
ForceType "text/css"
SetHandler default-handler
SetHandler modperl
PerlResponseHandler Bric::SOAP::Handler
PerlAccessHandler Apache2::Const::OK
SetHandler modperl
PerlResponseHandler Bric::Dist::Handler
ExpiresActive On
ExpiresDefault "now plus 0 seconds"
PerlFixupHandler Apache2::Const::OK
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 =3D '/admin/profile/dest?id=3D1024'
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
Re: Redirect WTF
am 27.01.2010 00:18:39 von Fred Moyer
On Tue, Jan 26, 2010 at 2:58 PM, David E. Wheeler wr=
ote:
> 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 w=
hen I don't expect it.
>
> To whit, I have this configuration:
I don't know if this could be an issue, but if I were to write this
config snippet, I would create a root block, and put the
transhandler outside that (with the other location based directives
inside).
>
> NameVirtualHost *:80
>
> =A0DocumentRoot =A0 =A0 =A0 =A0 =A0 /usr/local/bricolage/comp
> =A0ServerName =A0 =A0 =A0 =A0 =A0 =A0 benedict.local
> =A0DefaultType =A0 =A0 =A0 =A0 =A0 =A0"text/html; charset=3Dutf-8"
> =A0AddDefaultCharset =A0 =A0 =A0utf-8
> =A0SetHandler =A0 =A0 =A0 =A0 =A0 =A0 modperl
> =A0PerlResponseHandler =A0 =A0Bric::App::Handler
> =A0PerlAccessHandler =A0 =A0 =A0Bric::App::AccessHandler
> =A0PerlCleanupHandler =A0 =A0 Bric::App::CleanupHandler
> =A0PerlOptions =A0 =A0 =A0 =A0 =A0 =A0+GlobalRequest
> =A0RedirectMatch =A0 =A0 =A0 =A0 =A0permanent .*\/favicon\.ico$ http://be=
nedict.local/media/images/bricicon.ico
> =A0TraceEnable =A0 =A0 =A0 =A0 =A0 =A0off
> =A0PerlTransHandler =A0 =A0 =A0 Bric::App::PreviewHandler::uri_handler
> =A0
> =A0 =A0PerlAccessHandler =A0 Bric::App::AccessHandler::logout_handler
> =A0 =A0PerlCleanupHandler =A0Bric::App::CleanupHandler
> =A0
> =A0
> =A0 =A0SetHandler =A0 =A0 =A0 =A0 =A0modperl
> =A0 =A0PerlAccessHandler =A0 Bric::App::AccessHandler::okay
> =A0 =A0PerlResponseHandler Bric::App::Handler
> =A0 =A0PerlCleanupHandler =A0Bric::App::CleanupHandler
> =A0
> =A0
> =A0 =A0SetHandler =A0 =A0 =A0 =A0 =A0default-handler
> =A0 =A0PerlAccessHandler =A0 Apache2::Const::OK
> =A0 =A0PerlCleanupHandler =A0Apache2::Const::OK
> =A0
> =A0
> =A0 =A0ForceType =A0 =A0 =A0 =A0 =A0 "text/javascript; charset=3Dutf-8"
> =A0
> =A0
> =A0 =A0ForceType =A0 =A0 =A0 =A0 =A0 "text/css"
> =A0
> =A0
> =A0 =A0SetHandler =A0 =A0 =A0 =A0 =A0default-handler
> =A0
> =A0
> =A0 =A0SetHandler =A0 =A0 =A0 =A0 =A0modperl
> =A0 =A0PerlResponseHandler Bric::SOAP::Handler
> =A0 =A0PerlAccessHandler =A0 Apache2::Const::OK
> =A0
> =A0
> =A0 =A0SetHandler =A0 =A0 =A0 =A0 =A0modperl
> =A0 =A0PerlResponseHandler Bric::Dist::Handler
> =A0
> =A0
> =A0 =A0ExpiresActive =A0 =A0 =A0 On
> =A0 =A0ExpiresDefault =A0 =A0 =A0"now plus 0 seconds"
> =A0 =A0PerlFixupHandler =A0 =A0Apache2::Const::OK
> =A0
>
>
> Note that the hosthame is "benedict.local". Now I often just use localhos=
t when using Bricolage, and most of the time that works fine. But there is =
one JavaScript-triggered redirect button that looks like this:
>
> =A0 =A0window.location.href =3D '/admin/profile/dest?id=3D1024'
>
> And when I click it, The request goes to mod_perl and I see it come throu=
gh the access handler and the fixup handler as a request to localhost. But =
then the PerlReponseHandler never fires! Instead, I see another request com=
e 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 reque=
st 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 sa=
me 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
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Re: Redirect WTF
am 27.01.2010 00:22:34 von david
On Jan 26, 2010, at 3:18 PM, Fred Moyer wrote:
> I don't know if this could be an issue, but if I were to write this
> config snippet, I would create a root block, and put the
> transhandler outside that (with the other location based directives
> inside).
The transhandler isn't used in production Bricolage installs, so I'm not =
too worried about it. It's mostly just there for folks evaluating =
Bricolage, as it manages a sort of internal preview server. Production =
installs turn that off and use an external server for previews.
Thanks,
David
Re: Redirect WTF
am 27.01.2010 16:23:01 von Adam Prime
David E. Wheeler wrote:
> Fellow mod_perlers,
>
>
>
> 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.
>
This smells like a UseCanonicalName On + mod_dir redirect to me. If the
directory /admin/profile/dest exists in the document root, there's a
good chance it is.
HTH,
Adam
Re: Redirect WTF
am 27.01.2010 18:17:57 von david
On Jan 27, 2010, at 7:23 AM, Adam Prime wrote:
> This smells like a UseCanonicalName On + mod_dir redirect to me. If =
the directory /admin/profile/dest exists in the document root, there's a =
good chance it is.
Ooh, thanks! I can see that I have mod_dir as a DSO, but I'm not loading =
it. The only modules loaded are:
LoadModule perl_module /usr/local/apache2/modules/mod_perl.so
LoadModule expires_module modules/mod_expires.so
LoadModule apreq_module modules/mod_apreq2.so
Might the core be loading it somehow?
Thanks,
Daivd=
Re: Redirect WTF
am 27.01.2010 18:25:37 von Adam Prime
David E. Wheeler wrote:
> On Jan 27, 2010, at 7:23 AM, Adam Prime wrote:
>
>> This smells like a UseCanonicalName On + mod_dir redirect to me. If the directory /admin/profile/dest exists in the document root, there's a good chance it is.
>
> Ooh, thanks! I can see that I have mod_dir as a DSO, but I'm not loading it. The only modules loaded are:
>
> LoadModule perl_module /usr/local/apache2/modules/mod_perl.so
> LoadModule expires_module modules/mod_expires.so
> LoadModule apreq_module modules/mod_apreq2.so
>
> Might the core be loading it somehow?
It appears that mod_dir is compiled and loaded by default unless you
take steps to exclude it:
http://httpd.apache.org/docs/2.2/mod/mod_dir.html
http://httpd.apache.org/docs/2.2/mod/module-dict.html#Status
Adam