收藏
回答

微信支付使用nginx代理https://api.mch.weixin.qq.com时返回401?

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直接使用微信域名时正常调起

回答关注问题邀请回答
收藏

1 个回答

  • Memory (私信不回复)
    Memory (私信不回复)
    03-18

    加一下这个试试

    proxy_set_header Authorization $http_authorization; 
    


    03-18
    有用 1
    回复
登录 后发表内容