Hey,
I am trying to do the following:
When http://sub.domain.com.br
or https://sub.domain.com.br
or http://sub.domain.com.br?any=any&any2=any2
, etc… is requested, I would like there to be a redirect to http://domain.com.br?subdomain=sub
, http://domain.com.br?any=any&any2=any2&subdomain=sub
, etc, …
I don’t have a fixed list of possible subdomains.
And if http://domain.com.br
, http://www.domain.com.br
, http://www.domain.com.br?any=any
was requested, a standard subdomain would be used when resetting to http://domain.com.br?subdomain=defaultsub
, http://domain.com.br??any=any&subdomain=defaultsub
, etc…
I tried a few things, and they partially worked, but I’m not sure what the best way to do that would be either…
I tried for example to inject via nginx_http_include
, but it didn’t work as well as I would like.
After these rewrites/redirects, I would like all the rest of the behavior to be as if the user was making the request passing in the querystring subdomain.
What would be the most appropriate way for me to do this?
The main purpose here is actually to use subdomains to identify tenants.
Thank you