Apache NameVirtualHost on port 443 ignores ServerAlias
Posted
by
Ryan
on Server Fault
See other posts from Server Fault
or by Ryan
Published on 2012-04-05T22:04:05Z
Indexed on
2012/04/05
23:32 UTC
Read the original article
Hit count: 324
I've got a name-based virtual host setup on port 443 such that requests on host 'apple.fruitdomain' are proxied to the apple-app and requests on host 'orange.fruitdomain' are proxied to orange-app. This is working, but I'd like to add a ServerAlias for each such that requests on host 'apple' are proxied to apple-app and requests on host 'orange' are proxied to the orange-app. If I simply add a ServerAlias directive to the virtual host it doesn't work. ssl.conf below:
Listen 443
NameVirtualHost *:443
<VirtualHost *:443>
ServerName apple.fruitdomain
ServerAlias apple
SSLProxyEngine on
ProxyPass /apple-app https://localhost:8181/apple-app
ProxyPassReverse /apple-app https://localhost:8181/apple-app
...
</VirtualHost>
<VirtualHost *:443>
ServerName orange.fruitdomain
ServerAlias orange
SSLProxyEngine on
ProxyPass /orange-app https://localhost:8181/orange-app
ProxyPassReverse /orange-app https://localhost:8181/orange-app
...
</VirtualHost>
Interestingly if I do a similar setup but with port 80 then the ServerAlias works...
© Server Fault or respective owner