我想配置Nginx反向代理服務器,它將通過HTTP將所有請求重定向到我的AWS Api Gateway端點(它是一種GET方法)。 (如果你想知道爲什麼,原因是我有一個AWS Lambda函數,我希望第三方供應商通過Api網關進行調用,但是他目前有一個ssl_handshake與AWS的錯誤,可能是因爲SNI。我會給他這個HTTP代理服務器)。Nginx proxy_pass to aws Api網關
我已經試過這樣的事情:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name MY_SERVER_NAME;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location/{
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass https://SOMETHING.execute-api.REGION.amazonaws.com/dev/RESOURCE/METHOD;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
proxy_buffering off;
}
}
但我目前從CloudFront的獲取403,當我嘗試打電話
http://MY_SERVER_NAME
我覺得我缺少的東西我在Nginx的SSL配置,但我不知道是什麼。
其他客戶選擇在他們的API網關API前放置CloudFront分配以解決API網關的SNI需求。 –
這工作!謝謝。有沒有任何指導去做到這一點?這並不容易。此外,它使用CDN服務成爲不帶緩存的代理服務器非常醜陋,正如我剛剛所做的那樣 - 它可以與其他服務一起使用,可能是AWS LoadBalancer? – yishaiz
Elastic Load Balancer只能將流量發送到EC2實例。 –