Node.js: Self-signed HTTPS

Hello, reader of the post! I want to help you with your HTTPS on Node.js.
One day you will face with problem that you need use HTTPS instead of HTTP for server. I met this problem during embeding own widget to webpage.
If webpage has SSL certificate you will get an error. Your browser will say you something like "Hey buddy. Why do you use such cool and security SSL protocol for site, but you are trying connect with HTTP server. It is not seriously on my mind" :)
Of course it is the reason to change server protocol.
First of them you need to know that server SSL and site SSL are same things.
SSL certificate covers one domain and you can not extend it on subdomain (for example, "info.mysite,com" and "mysite.com" need others domains).
Выделение_645.png

This service will allow you to receive HTTPS certificate.
Then in Node.js you simply need to use built-in modules "https" and "fs".

Выделение_646.png

You need to include received files in production server and your application will receive HTTPS protocol.

Thank you for attention! Bye! :)

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center