Problems with redirects

j94305 nginx-forum at
Tue Oct 15 12:56:15 UTC 2019

Hi Danny,

  two comments:

1) Don't forget about $is_args$args to also pass any arguments supplied with
the URL.

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
actual challenge.

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.



Posted at Nginx Forum:,285882,285884#msg-285884

More information about the nginx mailing list