Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handler::Apache2::fixup_path messes up SCRIPT_NAME #321

Open
damil opened this issue Aug 31, 2012 · 1 comment
Open

Handler::Apache2::fixup_path messes up SCRIPT_NAME #321

damil opened this issue Aug 31, 2012 · 1 comment

Comments

@damil
Copy link

damil commented Aug 31, 2012

Context

I'm using modperl PerlAuthz handlers to control access to some parts of
my application, i.e. the Apache config looks more or less like this:

<Location /my_app>
SetHandler modperl
PerlResponseHandler My::Catalyst::App
PerlOptions +ParseHeaders
PerlOptions +SetupEnv

<LocationMatch "^/my_app/(foo|bar)/restricted">
PerlAuthzHandler My::Authorization::Module
# authz configuration options

<LocationMatch "^/my_app/(other|area)/restricted">
...

Problem

fixup_path() in Handler/Apache2.pm misinterprets the config.
When it calls $r->location, modperl returns the inner LocationMatch
directive, but that directive is just for authorization, it's not the
root of the application. Then $env->{SCRIPT_NAME} is incorrectly set to
the inner URL, whereas $ENV{SCRIPT_NAME} as given through
Apache+mod_perl is correct.

I don't really understand why this fixup_path() business is necessary,
since Apache+mod_perl already seems to do the proper job; but anyway,
if you need to keep that code, I guess there should be an additional
check to execute it only when running under ModPerl::Registry, not when
running under other modperl handlers.

For the moment, I hacked the "prepare_path" method in my Catalyst app
to work around this problem.

@damil
Copy link
Author

damil commented Aug 31, 2012

Sorry, the config example was messed up because of markdown rules. Here it is again :

<Location /my_app>
    SetHandler modperl
    PerlResponseHandler My::Catalyst::App
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv
</Location>

<LocationMatch "^/my_app/(foo|bar)/restricted">
    PerlAuthzHandler My::Authorization::Module
    # authz configuration options
</LocationMatch>


<LocationMatch "^/my_app/(other|area)/restricted">
    ...
</LocationMatch>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant