Select Page

How to enable HTTPS on live server ( Visual Studio Code)

Live Server is one of my favorite Visual Code extension which is used to launch a development local server with live reload feature for static & dynamic pages. Yes, it supports dynamic pages like PHP.

By default, it runs on HTTP.

In order to enable HTTPS protocol, first, you will need a self-signed SSL Certificate. If you don’t know how to create a self-signed SSL Certificate goto here and follow the steps.
[Note: If you are using Visual Code in windows, download OpenSSL and continue the process.]

After you have the private key and certificate:

    • Go to your visual code project.
    • Create .vscode folder inside the project. ( Don’t forget the . (period) ).
    • Inside that folder create settings.json file.
    • Paste the following code:
      {
      "liveServer.settings.https": {
      "enable": true, //set it true to enable the feature.
      "cert": "D:\\https\\primary.crt", //full path of the certificate
      "key": "D:\\https\\private.key", //full path of the private key
      "passphrase": "12345"
      }
      }
    • Start the Live Server and access your project using HTTPS

Find this project on github.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *