On 2013-09-24 11:38, Christoph Gröver wrote:
Hello list, Hello Sorin, I tested several different Apaches (2.4.x and 2.2.x) and they never did the wanted or expected. If I configure more than one VHost only the first one is returned by the server->server_hostname structure. The one of the second vhost that is configured as a "ServerName" seems to be impossible to determine? Is there any other way to find the hostname?
I suppose you use the server field of the request_rec structure and not some stored server_rec that was passed to you in post_config or somewhere else.
Apache keeps a linked list of server_rec structures. The head of the list is the server_rec of the whole apache server. The rest of the list contains one server_rec structure per vhost. For each request apache picks the right server_rec from the list according to the Host header and sets r->server to point to the picked object.
Also make sure that your request really arrives in the vhost you intended. Typically I check this by logging to different files (see the CustomLog directive) in each vhost.
Regards, Sorin