From 2ecbd7cbdfca9c11269649501378629e5d5ffef6 Mon Sep 17 00:00:00 2001 From: Nick Marinelli Date: Tue, 6 Sep 2022 16:59:29 -0400 Subject: [PATCH] update for #13338 changes, and option Signed-off-by: Nick Marinelli --- .../docs/tutorials/enable-ssl-self-signed.md | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/contrib/docs/tutorials/enable-ssl-self-signed.md b/contrib/docs/tutorials/enable-ssl-self-signed.md index 18d9752ba2..67c7091341 100644 --- a/contrib/docs/tutorials/enable-ssl-self-signed.md +++ b/contrib/docs/tutorials/enable-ssl-self-signed.md @@ -5,37 +5,45 @@ If you need to use an `https:` URL for local testing (i.e. if an OAuth provider ## Backend 1. Generate a self-signed certificate and key for localhost and configure your system to trust it. The application ["mkcert"](https://github.com/FiloSottile/mkcert) is a helpful tool to accomplish this. -1. Update `backend.baseUrl` in app-config.local.yaml to use an `https:` address, and copy the contents of the certificate and key files into `backend.https.certificate.cert` and `backend.https.certificate.cert`, respectively. Your app-config.local.yaml should look something like: +1. Update `backend.baseUrl` in app-config.local.yaml to use an `https:` address. +1. Add the certificate and key to `backend.https.certificate.cert` and `backend.https.certificate.cert`, respectively. ```yaml backend: baseUrl: https://localhost:7007 https: certificate: + # You may copy the contents of the file... cert: | -----BEGIN CERTIFICATE----- MIIDCTCCAfGgAwIBAgIUZ9VhZckcy690L ... -----END CERTIFICATE----- - key: | - -----BEGIN PRIVATE KEY----- - MIIEvAIBADANBgkqhkiG9w0BAQ - ... - -----END PRIVATE KEY----- + # ... or use a path + key: + $file: ./certs/localhost-key.pem ``` 1. Start the backend with `NODE_EXTRA_CA_CERTS=/absolute/path/to/cert.pem yarn start-backend` ## Frontend -Webpack will generate a self signed certificate automatically in development environments when the protocol in the `baseUrl` is `https`. Therefore, simply add this to your local config: +1. As with the backend instructions above, a trusted certificate and key are needed. +1. Update `app.baseUrl` and `backend.cors.origin` in app-config.local.yaml to use an `https:` address. +1. Add the certificate and key to `app.https.certificate.cert` and `app.https.certificate.cert`, respectively. -```yaml -app: - baseUrl: https://localhost:3000 -backend: - cors: - origin: https://localhost:3000 -``` + ```yaml + app: + baseUrl: https://localhost:3000 + https: + certificate: + cert: + $file: ./certs/localhost.pem + key: + $file: ./certs/localhost-key.pem + backend: + cors: + origin: https://localhost:3000 + ``` -and start the app with `yarn start`. As with the backend instructions above, the certificate must be trusted. +1. and start the app with `yarn start`. Depending on what plugins are in use, you may need to override additional URLs to use `https` for those endpoints to work.