Changing the request based on the domain begining

We have an application where we expect the request in the form
mydomain.com/app/?db=name Where “name” is the customer ID and there could be 100’s of possible names (I hope…)

The customers wish to connect to a vanity URL of name.mydomain.com

To date I have used a redirect with:
http-request set-var(req.subdomain) req.hdr(host),lower,regsub(.mydomain.com$,) if { hdr_end(host) -i .mydomain.com }
http-request redirect code 302 location https://host.mydomain.com/app/?db=%[var(req.subdomain)] if is_app

This works but the end user has the url https://host.mydomain.com/app/?db=name and while it works I have complaints

How would you solve this :slight_smile:

Tim

Isn’t rewriting a better option than redirect? Something like

http-request set-path /app/?db=%[var(req.subdomain)] if is_app