SSL errors when using `gatsby develop --https`
See original GitHub issueDescription
When running gatsby develop --https
both with without --cert-file
/--key-file
SSL does not work in Firefox, Chrome or Safari (screenshots below).
Steps to reproduce
- I’ve created a minimal reproduction in https://github.com/patrickarlt/gatsby-ssl-issue-reproduction. This is based off the default starter with the latest version of Gatsby.
npm install
npm run start:devcert
this starts the local dev server and automatically creates SSL certs.- Observe failures.
- Install
mkcert
, for Mac this means:brew install mkcert
brew install nss
mkcert install
mkcert localhost
npm run start:local-certs
this starts the dev server with the local certs frommkcert
- Observe failures.
In order to check that the certs are valid you can use http-server
:
npm i -g http-server
http-server . -C localhost.pem -K localhost-key.pem -S -a localhost
This displays the directory structure of our project tin the browser over https://...
note the lock icon in Chrome:
Expected result
The server should successfully serve pages over https://...
.
Actual result
Browsers produce SSL errors.
Environment
Gatsby
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 14.3.0 - ~/.nvm/versions/node/v14.3.0/bin/node
npm: 6.14.5 - ~/.nvm/versions/node/v14.3.0/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 81.0.4044.138
Firefox: 77.0
Safari: 13.1
npmPackages:
gatsby: ^2.22.3 => 2.22.3
OpenSSL
$ openssl version
LibreSSL 2.6.5
mkcert
$ brew info mkcert
mkcert: stable 1.4.1 (bottled)
Simple tool to make locally trusted development certificates
https://github.com/FiloSottile/mkcert
/usr/local/Cellar/mkcert/1.4.1 (6 files, 5.3MB) *
Poured from bottle on 2020-04-08 at 18:45:14
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mkcert.rb
==> Dependencies
Build: go ✘
==> Analytics
install: 3,827 (30 days), 11,641 (90 days), 47,679 (365 days)
install-on-request: 3,351 (30 days), 10,186 (90 days), 40,390 (365 days)
build-error: 0 (30 days)
nss
$ brew info nss
nss: stable 3.52 (bottled)
Libraries for security-enabled client and server applications
https://developer.mozilla.org/docs/NSS
/usr/local/Cellar/nss/3.52 (225 files, 34.1MB) *
Poured from bottle on 2020-05-19 at 16:52:58
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/nss.rb
==> Dependencies
Required: nspr ✔
==> Analytics
install: 38,963 (30 days), 105,774 (90 days), 394,028 (365 days)
install-on-request: 8,110 (30 days), 19,022 (90 days), 62,334 (365 days)
build-error: 0 (30 days)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:35 (10 by maintainers)
Top Results From Across the Web
Local HTTPS
Gatsby provides a way to use a local HTTPS server during development, thanks to devcert. When you enable the https option, a private...
Read more >How to enable https for GatsbyJS development server
I'll show you how to self-sign a SSL cert, and run gatsby develop in https. ... If embedded on a site running on...
Read more >How to serve gatsby development build on local network ...
When you are using a custom host, you need to provide the ssl certificate paths. ... gatsby develop --host $(hostname) --https --key-file ....
Read more >Unable to get local issuer certificate using gatsby
I get an "unable to get local issuer certificate" error when using gatsby develop related to FetchError: request to ...
Read more >failed, reason: unable to verify the first certificate
The first time I run Gatsby with SSL activated, an error occured. So now the error is fixed, when I run gatsby develop...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still facing the same problem in 2022 with gatsby 4.13.0
Was trying to access my app in dev mode via HTTPS on my real domain, but receive SSL errors no matter what certs I use.
I need real domain for cookie authorization on back-end (Laravel Sanctum).
@pieh thank you, issue is solved for us, both dev and prod and test working great, although there is one new issue #24758