-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up SSL on localhost
Chad Burt edited this page Nov 22, 2021
·
1 revision
It can be quite helpful to run the stack on the local network using ssl so that it can be accessed by mobile devices. Doing so is a little complicated. These instructions assume you are on MacOS.
brew install mkcert
mkcert -install
cd @seasketch/next
mkdir -p .cert
# replace 192.168.1.4 with your machines local IP
mkcert -key-file ./.cert/key.pem -cert-file ./.cert/cert.pem localhost 192.168.1.4
# packages/client/.env
HTTPS=true
SSL_CRT_FILE=../../.cert/cert.pem
SSL_KEY_FILE=../../.cert/key.pem
# again, replace 192.168.1.4 with your machines local IP
REACT_APP_PUBLIC_URL=https://192.168.1.4:3000
REACT_APP_GRAPHQL_ENDPOINT=https://192.168.1.4:3857/graphql
# packages/api/.env
SSL_CRT_FILE=../../.cert/cert.pem
SSL_KEY_FILE=../../.cert/key.pem
Be sure to run source .env
from the respective server directories before starting services using the normal npm scripts.
Follow mkcert's instructions for getting the root CA installed on your test device.