nginx反代参考配置

``` location ^~/sdk { index index.html index.htm index.php; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 50m; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Scheme $scheme; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; if ($request_method = 'OPTIONS') { #复杂接口浏览器会发 options请求,优化Options请求反馈时间 proxy_hide_header Access-Control-Allow-Origin; add_header Access-Control-Allow-Origin "*"; proxy_hide_header Access-Control-Allow-Methods; add_header Access-Control-Allow-Methods "GET,POST,PUT,DELETE,PATCH,OPTIONS"; return 200; } #跨域处理 proxy_hide_header Access-Control-Allow-Origin; add_header Access-Control-Allow-Origin "*"; proxy_hide_header Access-Control-Allow-Credentials; add_header Access-Control-Allow-Credentials "true"; proxy_hide_header Access-Control-Allow-Headers; add_header Access-Control-Allow-Headers "*"; proxy_hide_header Access-Control-Allow-Methods; add_header Access-Control-Allow-Methods "GET,POST,PUT,DELETE,PATCH,OPTIONS"; #部署好签服务的服务器,需换成对应的IP地址 proxy_pass http://ip:8080/sdk; } location ^~/wellsignfile { index index.html index.htm index.php; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 50m; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Scheme $scheme; proxy_redirect off; proxy_connect_timeout 240; proxy_send_timeout 240; proxy_read_timeout 240; if ($request_method = 'OPTIONS') { #复杂接口浏览器会发 options请求,优化Options请求反馈时间 proxy_hide_header Access-Control-Allow-Origin; add_header Access-Control-Allow-Origin "*"; proxy_hide_header Access-Control-Allow-Methods; add_header Access-Control-Allow-Methods "GET,POST,PUT,DELETE,PATCH,OPTIONS"; return 200; } #跨域处理 proxy_hide_header Access-Control-Allow-Origin; add_header Access-Control-Allow-Origin "*"; proxy_hide_header Access-Control-Allow-Credentials; add_header Access-Control-Allow-Credentials "true"; proxy_hide_header Access-Control-Allow-Headers; add_header Access-Control-Allow-Headers "*"; proxy_hide_header Access-Control-Allow-Methods; add_header Access-Control-Allow-Methods "GET,POST,PUT,DELETE,PATCH,OPTIONS"; #部署好签服务的服务器,需换成对应的IP地址 proxy_pass http://ip:8080/wellsignfile; } ```