【发布时间】:2021-08-16 07:40:34
【问题描述】:
我正在尝试将 Nginx 反向代理设置为 AWS API 网关地址,例如公司代理后面的 https://12345.execute-api.eu-central-1.amazonaws.com/v2。
我尝试对www.example.com 进行以下设置,它可以工作。但是,一旦我像https://www.example.com 一样将https 添加到它,它就会失败。我添加了 https,因为没有它就无法访问我的 API 网关地址。
当前工作配置:
server {
listen 80;
listen [::]:80;
listen 443;
underscores_in_headers on;
location / {
proxy_pass_request_headers on;
proxy_set_header Host www.example.com;
proxy_pass http://myCorporateProxy.org:8080;
}
}
我想要实现的目标和错误:
将所有传入流量重定向到 localhost 以重定向到类似于 https://123456.execute-api.region.amazonaws.com/v2/ 的 API 网关地址
尝试以下配置时,我收到 302 临时移动错误。
在配置中它看起来像这样:
server {
listen 80;
listen [::]:80;
listen 443;
underscores_in_headers on;
location / {
proxy_pass_request_headers on;
proxy_set_header Host https://www.example.com;
proxy_pass http://myCorporateProxy.org:8080;
}
}
【问题讨论】:
标签: nginx nginx-reverse-proxy nginx-config