I want to add ServerAlias to all VirtualHosts based on ServerName value and
database information.

First I tried to do it with PostConfigHandler, but tree modification did not
work.
Then I made ServerName handler.

Here I try to set my own ServerName, but that doesn't work.

my @directives = (
      {
       name         => 'ServerName',
       func         => __PACKAGE__ . '::MyParameter',
       req_override => Apache2::Const::OR_ALL,  // sure I can fix
req_override and args_how later
       args_how     => Apache2::Const::ITERATE,
       errmsg       => 'ServerName Entry1 [Entry2 ... [EntryN]]',
      }
);

Apache2::Module::add(__PACKAGE__, [EMAIL PROTECTED]);
  
sub MyParameter {
        my($self, $parms, @arg) = @_;
      
        # leave default host to learn if we succeeded
        if ($arg[0] eq 'default.x') { 
                return DECLINE_CMD; 
        }               
        
        $self->{'ServerName'} = 'bla.x';
      
        return DECLINE_CMD;
}


How to update configuration of current Vhost in directive handler ?
How to change ServerName in my case ?

Thank you!

Reply via email to