node.js (express) 上的 Alexa Skill Server 使用 nginx 作为反向代理 (https)

编程入门 行业动态 更新时间:2024-10-18 01:41:12
本文介绍了node.js (express) 上的 Alexa Skill Server 使用 nginx 作为反向代理 (https)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在我的 Debian 8.5 64bit 上运行一个 nginx,它用作我的节点应用程序的反向代理.在路由到特殊应用程序之前,每个请求都会通过我的反向代理.因此我使用这个配置:

i am running a nginx on my Debian 8.5 64bit which is used as reverse proxy for my node applications. Each request walks through my reverse proxy before getting routed to the special apps. Therefor i am using this config:

upstream socket_nodes { server 127.0.0.1:3000; server myUrl:3000; server MY.ROOTSERVER.IP.ADDRESS:3000; } server { listen 80 default_server; listen [::]:80 default_server; server_name myUrl; return 301 $server_name$request_uri; } server { # SSL configuration # listen 443 ssl default_server; listen [::]:443 ssl default_server; include snippets/ssl-my-website.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; root /root/webserver/app/; location ~ /.well-known { allow all; } location / { proxy_pass 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 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 socket_nodes; } # pass the PHP scripts 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's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} }

遗憾的是这不起作用.我可以通过 https (www.myWebsite) 访问我的网站,并且运行良好.

Sadly this is not working. I can reach my website via https (www.myWebsite) and it works fine.

所以我将 Amazon Developer Console 中我的 alexa 技能的端点更改为:www.myWebsite/alexa-api(有和没有尾随 /) 但它不起作用.当我在本地使用并通过 ngrok 使其可用时,技能服务器本身就可以工作.我在这里做错了什么?

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

还有一个 socket.io 服务器在同一个应用程序中运行,可以从互联网访问(服务器记录新客户端连接") - 但我不能在它们之间发出任何事件.socket.io 连接的 HTTP Status Code 是(正确的)101 Switching Protocols.

There is also a socket.io server running in the same app which can be accessed from the internet (the server loggs "new client connected") - but i can not emit any events between them. The HTTP Status Code of the socket.io connection is (correctly) 101 Switching Protocols.

问候

推荐答案

当你有 HTTPS 时,你也应该通过 https 方案

When you have a HTTPS you should also pass https scheme

proxy_pass socket_nodes;

更多推荐

node.js (express) 上的 Alexa Skill Server 使用 nginx 作为反向代理 (https)

本文发布于:2023-11-28 07:09:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641417.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:express   Alexa   node   js   nginx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!