I have an issue trying to get the subdomain as a variable and use it somewhere in another part
what I'm trying to do is a proxy configuration that allow me to connect between
aaa.example-example.com will show me example.com/aaa
and
bbb.example-example.com will show me example.com/bbb
my code :
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName wildcard.example.com
ServerAlias *.example.com
ServerAdmin webmaster@localhost
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# the pattern of my website look like example-example.com
SetEnvIf Host "^([^.]*).example-example.come$" SUBDOMAIN=$1
SSLProxyEngine on
ProxyPass / https://example1.com/%{ENV:SUBDOMAIN}
ProxyPassReverse / https://example1.com
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com-0001/privkey.pem
</VirtualHost>
</IfModule>
so SetEnvIf
is not working and always printing %{ENV:SUBDOMAIN} instead of the actual subdomain
I have the exact problem explained in
https://stackoverflow.com/questions/36199764/setting-the-subdomain-as-a-variable-in-apache-config-to-be-used-in-the-same-conf
but I already have the same solution and it didn't work
I'm using Apache/2.4.29 (Ubuntu)
I'm happy with any solution to the variable in the ProxyPass part.
thanks