如何解决Nginx,Minio和Traefik 2的302重定向错误
我正在尝试通过Minio和Nginx为静态站点提供服务,在其中通过Traefik 2处理路由。
events {
}
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=blog_cache:10m max_size=1g inactive=1d use_temp_path=off;
server {
server_name unexpectedeof.xyz www.unexpectedeof.xyz blog.unexpectedeof.xyz;
index index.html;
location / {
limit_except GET {
deny all;
}
proxy_hide_header "X-AMZ-Bucket-Region";
proxy_hide_header "X-AMZ-Request-Id";
proxy_cache blog_cache;
proxy_cache_valid 200 1h;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_revalidate on;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_pass http://minio.unexpectedeof.xyz;
}
}
}
这可行,但是我想保留原始主机,然后转到基于存储桶的路由。为此,我尝试使用minio docs中的示例,但是我发现302
的重定向过多。
server {
server_name unexpectedeof.xyz www.unexpectedeof.xyz blog.unexpectedeof.xyz;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 50m;
# To disable buffering
proxy_buffering off;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1,keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio.unexpectedeof.xyz; # If you are using docker-compose this would be the hostname i.e. minio
# Health Check endpoint might go here. See https://www.nginx.com/resources/wiki/modules/healthcheck/
# /minio/health/live;
}
}
关于我所缺少的任何建议吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。