简体   繁体   English

我无法通过 https 快速访问路线

[英]I can't access routes via https in express

I built an application with express of node.js.我用 node.js 的快递构建了一个应用程序。

 const express = require('express'); // servidor de desenvolvimento const app = express(); app.listen(3000, () => { console.log(`http://localhost:3000`); });

when I run the server and try access it with https://my_local_IP:port in browser I get ERR_SSL_PROTOCOL_ERROR , but if I use https://my_local_IP:port it works.当我运行服务器并尝试在浏览器中使用 https://my_local_IP: https://my_local_IP:port访问它时,我得到ERR_SSL_PROTOCOL_ERROR ,但是如果我使用https://my_local_IP:port它就可以工作。

How do I make the app to listen in on http port, even to requests in https port?如何让应用程序监听 http 端口,甚至监听 https 端口的请求?

You'll need an SSL certificate on the server you're running express on.您需要在运行 express 的服务器上获得 SSL 证书。 You can check out this answer for more information on how to do that您可以查看此答案以获取有关如何执行此操作的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM