Hello all, I use mod_perl's <perl> sections quite intensively so that I can have one config for all our webservers, and so that I can change some settings easily using variables. I recently noted however that <perl> sections are treated differently when doing a restart (httpd -k restart) than when doing a full stop and then a start.
Let's illustrate this with a snippet form my config: (I've removed most of the config, and only kept the bits I think are relevant) <perl> if ( $ENV{SWITCH} eq "test" ) { $backend = "testserver" ; } elsif ( $ENV{SWITCH} eq "prod" ) { $backend = "prodserver ; } else { $backend = devserver ; } $backendurl="http://" . $backend . ":8080/app"; print STDOUT "backend url is $backendurl\n"; push @PerlConfig, split ("\n", <<EOF); Listen 8080 Listen 443 NameVirtualHost *:80 <VirtualHost *:80> # define servername and other virtual host directives here. RewriteRule ^/app/(.*)\$ http://$backendurl/\$1 [P] </VirtualHost> EOF </perl> The idea is that before I start the apache server I can set an environment variable "SWITCH" to either "test" "prod" or nothing, and have the server forward incoming requests to different backends. To have some feedback I have the server echo what it is going to use as "bacendurl". Here is where it starts to get odd. When I set the environment variable SWITCH to eg. "prod" and start the webserver it will output the following to the terminal: "backend url is http://prodserver:8080/app" and requests are properly proxied to the production server. So far so good. It is behaving exactly as expected. When I then set SWITCH to "test" and do a server restart, using httpd -k restart I get the following output: "backend url is http://testserver:8080/app" but, and this is the odd thing, the server keeps forwarding requests to the production server. I exepcted it to start redirecting to the test server. From the output I get it is obvious that the perl section gets executed. But it is as if the @perlconfig that is created is ignored during a restart. When I do a httpd -k stop followed by a httpd -k start I don't have this problem. Then everything performs as expected. Why is this? Krist -- [EMAIL PROTECTED] Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions?