location / {
fastcgi_intercept_errors on;
proxy_pass https://drive.google.com/uc?$query_string;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host drive.google.com;
proxy_set_header Referer https://drive.google.com;
error_page 301 302 307 = @handle_redirects;
}
location @handle_redirects {
set $redirect_location '$upstream_http_location';
proxy_pass $redirect_location;
proxy_cache ngx-cache;
proxy_cache_key $query_string;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
curl -I -A“ ua” https://server/dl?id=trhtyjkfktkghjsutrtujyuk直接返回302而不是转到handle_redirects部分,此配置可用于服务器Tengine的另一台vps,但不适用于原始版本的另一台vps nginx,不知道哪里出了问题。任何帮助将不胜感激。谢谢!
答案 0 :(得分:0)
我相信您需要添加:
proxy_intercept_errors on;