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 (将#修改为@)