My intention is to capture HTTPS requests as they come in, break the URI down, and then dynamically change DocumentRoot, Logs, etc based on whether a given URI meets my set of criteria.
Example:
http://domain.tld = DocumentRoot /home/domain.tld/htdocs
https://secure.provider.tld/secure/domain.tld/
URI is parsed for ^/secure/([.]*[\.]+[.]*)/(.*)
<Perl> DocumentRoot is then dynamically replaced with $1 </Perl>
I was trying to use mod_rewrite and mod_vhost_alias to do this, but I just could not get the environment variables into DocumentRoot.
I thought this might be possible with <Perl> sections?
Thank you for your assistance.
Respectfully,
Gary
Geoffrey Young wrote:
Gary C. New wrote:
mod_perl = 1.27
I am trying to setup a <Perl> section in my httpd.conf file that will retrieve the web server's environment variables. I've tried several methods and all lead me back to the same problem.
I first tried using PerlPassEnv but could never get any environment variables from it. I also understand there is a great deal more overhead using this method.
I then tried using $r->subprocess_env but always received an error regarding Can't call method "subprocess_env"on an undefined value. I believe this routine is a part of the Apache module. I verified that it was in the perl lib path and then attempted to "use" it in the <Perl> section.
I finally tried using $r->parsed_uri but, again, continue to receive an error regarding Can't call method "parsed_uri" on an undefined value. The routine is part of the Apache::URI module, which I verified was in the path and then attempted to "use" in the <Perl> section.
all of this makes me think that you're after things like $ENV{REMOTE_USER} and other CGI environment variables?
in general, <Perl> sections within a httpd.conf are executed when Apache is started. that means that there is no request to associate with a client, so no $ENV{REMOTE_USER} or other things make any sense. that's also why you couldn't call $r->subprocess_env or $r->parsed_uri - there is no $r at config time.
so, if it's these environment variables you're looking for, you'll need to take a step back and assess what you're really trying to do.
if you're after other things - such as variables from /etc/profile - but can't access them in <Perl> sections that's a different issue, and something that I'd need to try and recall, as I thought they should be visible at that point.
--Geoff
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html