'Apache: Reverse Proxy based on subdomain
I'm trying to set a reverse proxy by replacing the domain and keeping the subdomain. What I want to achieve is:
abc.example.org
shall be reverse proxied toabc.hello.dev
xyz.example.org
shall be reverse-proxied toxyz.hello.dev
Note: abc, xyz, etc. are completely dynamic.
What I'm currently not getting is the syntax for ProxyPass and ProxyPassReverse.
Thank you very much,
Cheers Fritz
Solution 1:[1]
Found the solution:
<IfModule mod_proxy.c>
SetEnvIf Host "^([^.]*).example.org$" SUBDOMAIN=$1
ProxyPassInterpolateEnv On
ProxyPass / https://${SUBDOMAIN}.hello.dev/ interpolate
ProxyPassReverse / https://${SUBDOMAIN}.hello.dev/ interpolate
</IfModule>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | fritz |