how to redirect https requests to specific port

by Niko Gamulin   Last Updated October 09, 2019 18:00 PM

I have create a node.js application that communicates with facebook messenger and runs on aws.

For https, I use nginx; the configuration I use now is the following:

server {
     listen 443 ssl;
     server_name www.example.com;
     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
     location / {
       proxy_set_header  X-Real-IP  $remote_addr;
       proxy_set_header  Host       $http_host;
       proxy_pass        http://127.0.0.1:3000;
     }
  }

The node.js app runs on port 3000 and right now I use ngrok to forward https requests to port 3000. I would like to turn off ngrok and appropriately configure nginx.

Facebook messenger makes a post request to the address that is configured as follows: enter image description here

I tried to change the ngrok address with https://example.com/webhook and https://[IP address]/webhook but none of it worked.

Does anyone know what is the right way to forward https requests to specific ports?

Tags : nginx ssl


Related Questions


Updated September 16, 2019 18:00 PM

Updated August 03, 2019 14:00 PM

Updated March 27, 2015 07:00 AM

Updated March 26, 2015 14:00 PM