admin管理员组文章数量:1291038
I'm trying to exclude two URLs from nginx redirect (http to https). Traffic from Nginx is sent to guincorn and the URLs are generated dynamically by the Django view.
My current base nginx configuration for the site is below. All non http requests are sent to https using this.
server {
listen 80;
listen [::]:80 default_server;
server_name mydomain;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate ....;
ssl_certificate_key ....;
root /app/ioc;
server_name mydomain;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
alias /path/static/;
}
location / {
proxy_pass http://unix:/run/gunicorn.sock;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
}
Now, I'm trying to exclude both this/endpoint1.txt
and this/endpoint2.txt
from the redirects. endpoint1.txt
and endpoint1.txt
are dynamically generated by the django view so they are not actual text files on the server.
Trying to do something like this results in 404 error
location /this/endpoint1.txt {
root /path/app;
add_header Content-Type text/plain;
}
Also, when I do something like this:
location /this/endpoint1.txt {
proxy_pass http://127.0.0.1:80;
}
I get 504 Gateway Time-out error.
I'm binding gunicorn like this "0.0.0.0:8000"
本文标签: djangoexclude specific urls from nginx redirectStack Overflow
版权声明:本文标题:django - exclude specific urls from nginx redirect - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741505200a2382278.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论