【问题标题】:nginx reverse proxy 302 custom handler not workingnginx反向代理302自定义处理程序不起作用
【发布时间】:2019-08-01 08:13:40
【问题描述】:
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,但它不适用于我的另一个带有原始版本 nginx 的 vps,不知道哪里出了问题。任何帮助将不胜感激。谢谢!!

【问题讨论】:

    标签: nginx nginx-reverse-proxy


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-03
      • 2019-06-15
      • 2020-06-23
      • 2019-06-05
      • 1970-01-01
      • 2017-06-29
      • 2021-09-15
      • 2019-05-03
      相关资源
      最近更新 更多