locked_user sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:

This website uses a rewrite-rule to send anything and everything to a CGI script (CGI::Application). The site uses the "ActionDispatch" plugin, which relies upon $ENV{'PATH_INFO'} to find the routine to call.

There is a RewriteRule that sends “anything that does not correspond to a physical file” to the cgi-bin script, and all that seems to be working as I expect.

The very odd thing, at least to me at least right now, is that I'm seeing this environment-variable showing up as undef ... but $ENV{'REQUEST_URI'} is properly defined. It contains the value that I intuitively expected. I am quite at a loss to explain why the other value is “missing entirely.”

Furthermore, it seems to be that way no matter what URI-string I use. (The “default” handler uses REQUEST_URI, therefore it works fine.)

An example of the sort of URI that comes up empty is... well, anything...   http://www.foo.bar/wonderfulproduct/info

In that situation, REQUEST_URI will be /wonderfulproduct/info and PATH_INFO will be undef. And I really don't know why it's undef.

I'm also contemplating exactly what to do about it... How might I diagnose the situation further, and then, much more to the point, make it go away? Categorically, I prefer not to “bypass” a problem until first I understand why it's happening, because who knows, it might be a symptom of a deeper issue that's just going to come back.

Replies are listed 'Best First'.
Re: Peculiar... Apache PATH_INFO is undef...
by ikegami (Patriarch) on Dec 06, 2007 at 22:25 UTC

    and all that seems to be working as I expect.

    We have very different meanings for "seems to be working"!

    Perl has no control over how Apache sets up environment variables. That is a problem with Apache, mod_rewrite or your mod_rewrite command.

    If you're asking for help to fix this, look elsewhere. This is not an Apache or mod_rewrite support site.

    If you're asking for help avoiding mod_rewrite, it would help if you tell us what is it that mod_rewrite does that you want Perl to do.

Re: Peculiar... Apache PATH_INFO is undef...
by aquarium (Curate) on Dec 06, 2007 at 22:44 UTC
    from memory, you have to change the apache config to provide PATH_INFO, which is outdated.
    the hardest line to type correctly is: stty erase ^H

      Can you elaborate on this a little bit? I didn't see anything about it in the CPAN listing for this plug-in... (It doesn't surprise me, and yes, my local-box is an Apache2. The host-server, I expect, is gonna be Apache-one-dot-ancient. So the issue's gonna “bite” me regardless...)

      Yes, oh Monks, I know that “this is not an Apache support site,” and I certainly respect that. It simply occurred to me that this would probably be a great concentration of “folks who would likely to be able to say ‘oh, yeah...’ and come up with the solution in a hurry. Especially given that we're ultimately talking about a CPAN-plugin (CGI Application Plugin ActionDispatch).

      I do beg your indulgence and hope that the question is not too-seriously misplaced.