location /wx-pay-api/ {
rewrite ^/wx-pay-api(/.*)$ $1 break;
proxy_pass https://api.mch.weixin.qq.com;
proxy_set_header Host api.mch.weixin.qq.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Cookie $http_cookie;
proxy_buffering off;
proxy_set_header Content-Type $http_content_type;
proxy_set_header Accept $http_accept;
}
使用上述代理时接口返回{"code":"SIGN_ERROR","message":"Http头Authorization值格式错误,请参考《微信支付商户REST API签名规则》,不使用nginx直接使用微信域名时正常调起
加一下这个试试
proxy_set_header Authorization $http_authorization;