https://bz.apache.org/bugzilla/show_bug.cgi?id=69330
Bug ID: 69330 Summary: default or primary server not well defined through ServerName Product: Apache httpd-2 Version: 2.4.62 Hardware: All OS: All Status: NEW Severity: minor Priority: P2 Component: Core Assignee: bugs@httpd.apache.org Reporter: muel...@online.de Target Milestone: --- According to: https://httpd.apache.org/docs/2.4/vhosts/examples.html The primary server is defined through the order of the VirtualHosts. However, this is practically random if different instances are configured within different example.com.conf files inside directory sites-enabled/. Concrete case: I had two services configured in files # /etc/apache2/sites-enabled/jitsi.my-example.com: <VirtualHost jitsi.my-example.com:80> ServerName jitsi.my-example.com Redirect permanent / https://jitsi.my-example.com/ </VirtualHost> <VirtualHost jitsi.my-example.com:443> ServerName jitsi.my-example.com ... and # /etc/apache2/sites-enabled/my-example.com: <VirtualHost my-example.com:80> ServerName my-example.com RewriteEngine on RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [L,R] </VirtualHost> <VirtualHost my-example.com:443> ServerName my-example.com ServerAlias my-example.de ServerName www.my-example.com ServerAlias www.my-example.de ... The problem was that I always got responses from the jitsi-site, like so: $ curl http://www.my-example.com <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="https://jitsi.my-example.com/">here</a>.</p> <hr> <address>Apache/2.4.62 (Debian) Server at www.my-example.com Port 80</address> </body></html> Nothing helped, whatsoever. Not even renaming the config-files to 1.my-example.com.conf and 2.jitsi.my-example.com.conf in the hope to enforce IncludeOptional sites-enabled/*.conf to read them in the corresponding order. (I never understood why jitsi.example.com answers at all, despite not being responsible for example.com. Replacing the explicit dns:port by a simple *:80 did not help either.) Finally I had to place the VirtualHost part from the jitsi-server inside the "primary" server's config behind <VirtualHost my-example.com:80>. From then on it worked like a charm. This "manipulation" is doable but I consider it an unpleasant workaround because config files start depending on one another instead of staying nicely separated. IMHO a relatively simple enhancement would be an additional config variable ServerNameDefault or DefaultServerName which may then appear only once to clearly identify the fallback server. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscr...@httpd.apache.org For additional commands, e-mail: bugs-h...@httpd.apache.org