1) Don't forget about $is_args$args to also pass any arguments supplied with
2) You cannot redirect requests with a request body, most importantly POST
and PUT, so your rule is only applicable for GET/HEAD requests.
I have no idea what you are really struggling with as you don't mention the
Regarding your server block:
- "listen 80 default_server;" is sufficient.
- You can specify server names, but your intention is to forward everything,
so you may as well omit it or write a dummy such as "server_name _;"
- You may want to add a different redirection if the request method is not
GET (or HEAD), so users will end up on the home page or somewhere else
meaningful and not have to face a funny error message the won't understand,
because a POST/PUT request did not specify a body.
Regarding the https service:
- If you use one IP address to serve multiple domains, get a SAN certificate
with all domain names added. This way, you can avoid using SNI.
On 15/10/2019 14:08, Reinis Rozitis wrote:
>> The problem is, whatever URL I put in the browser, it redirects to
>> https://trisect.uk _______________________________________________
>> server_name trisect.uk *.trisect.uk;
>> return 301 https://$server_name$request_uri; }
> For that I don't think you can use $server_name here because it will always be the first one picked no matter if the client passes site1.trisect.uk in Host header.
> Try with return 301 https://$host$request_uri; >
Ok, I think I'm there with the following server block, I think the main
problem was that I'd shot myself in the foot by using 301 redirects,
which Chrome was caching, testing with another browser showed everything
working as desired. Clearing the Chrome redirect cache has (I think)