-
Notifications
You must be signed in to change notification settings - Fork 214
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
Apache mod_rewrite rules don't take any affect under mod_perl ($r->unparsed_uri problem) #536
Comments
But that's how the app is accessed externally, so it is difficult to call it a bug (as you've originally stated). It is a known issue if you run a URL rewriting inside Apache URL translation phase Plack can't tell which URL is the path you want to use. In the case of Apache2 handler, the external URI is the URI it uses. Previously it was using the internal, rewritten |
Sure it is the original URI which was used to access the application. But the rewritten URI is also available in |
That's rather passive aggressive :) You can access Apache's request object with |
That's exactly what I'm doing now, just wish I didn't wast so much time looking for the problem elsewhere but not in Plack, expecting this stuff just work. |
Why don't you document that middleware (or even package it as a CPAN module) and submit as a doc patch? |
Well, the middleware package which allows to do it already exists: Plack::Middleware::Rewrite.
There should be a way to disable that. |
Am I right that this error is generated regardless of your rewrite stuff? This happens before any Plack Middleware kicks in. |
Correct, the error is there even without any middleware code involved. |
Well yeah, that's exactly why we were aware of the limitation of this PATH_INFO restoration and put that handy error message there. An option to turn them off and use |
Hi there,
I don't think this is necessarily a bug, but something which is definitely was not obvious to me and maybe deserves to be documented somewhere at least.
What I'm trying to achieve seemed very easy to me. I have two different APIs implemented in two different applications, one as a native mod_perl app, another one as a PSGI app, both running under mod_perl. I want to use mod_rewrite to re-route requests to a certain endpoint from the first API to the second API with no redirects. Sounds easy, and there are tons of examples on the internet how to do it with mod_rewrite. Here is a part of my apache config which I expected to work.
The problem is that it doesn't work. I can see in RewriteLog that the pattern is matched and apache does it part in passing through the rewritten URI, my PSGI app is reached but the URI it gets is actually
/api1/v1/endpoint
.After digging in and wasting a lot of time I found the problem in
Plack::Handler::Apache2
module,call_app
procedure and more specifically in using$r->unparsed_uri
. The thing is thatunparsed_uri
in this case returns the original URI, the modified URI is returned byuri
method.Not sure how this could be fixed, but this is definitely not a place where I'd expect to get problems like that. This thing makes it impossible to use apache mod_rewrite with Plack.
In case it matters, my apache version is 2.2.29.
The text was updated successfully, but these errors were encountered: