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 return 302 directly rather than go to handle_redirects section,this config works on my another vps with server Tengine,but it doens't work on my another vps with original edition nginx,have no idea where gone wrong.any help would be appreciated.thanks!!