Live article: https://www.storyblok.com/faq/setting-up-https-on-localhost-in-nuxt-3
- FAQ
- Setting Up HTTPS on localhost in Nuxt 3
During development, apps are usually served via HTTP. However, Storyblok v2 requires your app to be served via HTTPS. Please follow the steps below to enable this in a Nuxt 3 project.
Install
mkcert
on your system The installation instructions for macOS, Windows and Linux can be found in the mkcert Github repository.Create a valid certificate by running the following command in your project folder:
mkcert localhost
- In the project's
package.json
, change thenuxt dev
command to the following:
NODE_TLS_REJECT_UNAUTHORIZED=0 nuxt dev --https --ssl-cert localhost.pem --ssl-key localhost-key.pem
- Run your project using
npm run dev
. Your project will now be served on https://localhost:3000.