Skip to content

sitek94/localhost-https-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

localhost https

Fix the following error when trying to run local server using https:

Screen Shot 2022-08-13 at 16 30 47

Steps

Install mkcert and generate key and cert

# Install mkcert
brew install mkcert

# Create local CA (certificate authority)
mkcert -install

# Generate key and certificate for localhost
mkcert localhost

Pass an object with key and cert when creating new server using https:

const options = {
  key: '<YOUR_KEY>',
  cert: '<YOUR_CERT>',
}

https.createServer(options, (req, res) => { ... })

Resources

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks