title: Nginx proxy_pass to aws Api Gateway
body: <p>I want to configure Nginx reverse proxy server which will redirect all of the requests it gets by HTTP to my AWS Api Gateway endpoint which is HTTPS (its a GET method). (If you want to know why, the reason for this is that I have an AWS Lambda function which I want a 3rd party vendor to call via Api Gateway, but he currently has a bug with ssl_handshake with AWS, probably because of SNI. So I will give him this HTTP proxy server).</p>
  
  <p>I've tried something like this:</p>
  
  <pre><code>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;
          }
  }
  </code></pre>
  
  <p>But currently I'm getting 403 from CloudFront when I try to call to </p>
  
  <pre><code>http://MY_SERVER_NAME
  </code></pre>
  
  <p>I feel like I'm missing something in my SSL configurations at Nginx but I'm not sure what.</p>