Alexa Skill Server on node.js (express) using nginx as a reverse proxy (https)

I am running nginx on my Debian 8.5 64bit , which is used as a reverse proxy for my node applications. Each request goes through my reverse proxy before being redirected to special applications. Therefore, I use this configuration:

 upstream socket_nodes { server 127.0.0.1:3000; server myUrl.com:3000; server MY.ROOTSERVER.IP.ADDRESS:3000; } server { listen 80 default_server; listen [::]:80 default_server; server_name myUrl.com; return 301 https://$server_name$request_uri; } server { # SSL configuration # listen 443 ssl default_server; listen [::]:443 ssl default_server; include snippets/ssl-my-website.com.conf; include snippets/ssl-params.conf; # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name www.myWebsite.com; root /root/webserver/app/; location ~ /.well-known { allow all; } location / { proxy_pass http://localhost:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } location /alexa-api/ { proxy_pass http://localhost:3000; } location /at_backend/ { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://socket_nodes; } # pass the PHP s to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # # With php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; #} # deny access to .htaccess files, if Apache document root # concurs with nginx one # #location ~ /\.ht { # deny all; #} } 

Unfortunately this does not work. I can get to my site via https ( https://www.myWebsite.com ) and it works great.

So, I changed the endpoint of my alexa skill in the Amazon Developer Console to: https://www.myWebsite.com/alexa-api (with and without trailing / ), but it does not work. The skill server itself worked when I used it locally and made it available through ngrok . What am I doing wrong here?

change

There is also a socket.io server running in the same application that can be accessed from the Internet (server logs “new client connected”), but I can not emit any events between them. HTTP Status Code of socket.io connection (correct) 101 Switching Protocols .

Hello

+2
source share
1 answer

When you have HTTPS, you must also go through the https scheme.

 proxy_pass https://socket_nodes; 
0
source

Source: https://habr.com/ru/post/1244103/


All Articles