I have a application with dynamic subdomains that should be redirected to different servers depending on a part of the subdomain.
Example (anything means whateveryouwant, a dynamic name):
example.com --> server1
anything.example.com --> server1
a.example.com --> server2
b.example.com --> server1
a.anything.example.com --> server2
b.anything.example.com --> server1
anything.a.example.com --> server2
anything.b.example.com --> server1
a.anything.a.example.com --> server2
b.anything.a.example.com --> server2
I guess this is not possible to do with standard dns configuration. So instead I'm planning to point *.example.com to server1 and the configure apache to forward the request to server2 when it matches any of the criterias. Problem is that I don't know how to config apache for this. Does anyone have an idea of where to start?