简体   繁体   中英

I can't access routes via https in express

I built an application with express of 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.

How do I make the app to listen in on http port, even to requests in https port?

You'll need an SSL certificate on the server you're running express on. You can check out this answer for more information on how to do that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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