Welcome! Log In Create A New Profile

Advanced

nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Gena Makhomed
December 14, 2021 04:28PM
Здравствуйте!

Есть такой конфиг:

location /download {
proxy_pass http://unix:/run/gunicorn.sock;
}

location /download/ {
alias /home/www/download/;
charset utf-8;
autoindex on;
autoindex_localtime on;
}

при этом nginx почему-то и зачем-то делает самовольный редирект
с https://example.com/download на https://example.com/download/

$ curl -i https://example.com/download

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 14 Dec 2021 21:16:24 GMT
Content-Type: text/html
Content-Length: 162
Location: https://example.com/download/
Connection: keep-alive

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

Это баг в nginx ? Можно ли его исправить?

Добавление модификатора = также не помогает:

location = /download {
proxy_pass http://unix:/run/gunicorn.sock;
}

по прежнему происходит 301 редирект на страницу /download/

Если в конфиге поменять proxy_pass

location /download {
#proxy_pass http://unix:/run/gunicorn.sock;
proxy_pass http://127.0.0.1:5000;
}

тогда редиректа не происходит и запрос корректно передается на backend.

Но нужно чтобы все нормально работало именно с сокетом gunicorn.sock

--
Best regards,
Gena
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Gena Makhomed December 14, 2021 04:28PM

Re: nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Maxim Dounin December 14, 2021 06:34PM

Re: nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Gena Makhomed December 15, 2021 02:16AM

Re: nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Maxim Dounin December 15, 2021 08:40AM

Re: nginx BUG ? unexpected redirect from https://example.com/download to https://example.com/download/

Gena Makhomed December 15, 2021 09:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready