【发布时间】:2020-02-15 05:42:32
【问题描述】:
我的用例是我想路由以下请求 http://localhost/STAGE/RESOURCE/123 到 https://MyGatewayID.execute-api.us-west-2.amazonaws.com/STAGE/RESOURCE/123
其中 123 是路径参数
我正在尝试使用 Nginx 为我的 AWS API Gateway 设置反向代理,但在通过邮递员进行测试时出现以下错误
我们计算的请求签名与您提供的签名不匹配。检查您的 AWS 秘密访问密钥和签名方法。有关详细信息,请参阅服务文档。\n\n此请求的规范字符串应该是\n'GET\n/alpha/data/ ...
我已经配置了带有访问密钥和秘密的 AWS 授权标头,以便在使用 API Gateway url 时使用邮递员成功访问 API Gateway,但是当我用 localhost 替换它时,它给出了上述错误
这在邮递员中工作 https://MyGatewayID.execute-api.us-west-2.amazonaws.com/STAGE/RESOURCE/123
这在邮递员中不起作用 https://localhost/STAGE/RESOURCE/123
这是我的 nginx 配置
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://MyGatewayID.execute-api.us-west-2.amazonaws.com;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_buffering off;
}
【问题讨论】:
标签: nginx aws-api-gateway nginx-reverse-proxy nginx-config