nginx代理访问后端接口

location /api { 
      proxy_pass  xxxx.xxx.com/xxxx # 接口的url;
      proxy_redirect off;
      # 后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
      proxy_set_header  Host  $host;
      proxy_set_header  X-Real-IP  $remote_addr;  
      proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}

https://blog.csdn.net/qq_35687296/article/details/98511005

posted @ 2020-07-08 16:03  zhanglw  阅读(9973)  评论(0)    收藏  举报