update for #13338 changes, and option

Signed-off-by: Nick Marinelli <nmarinelli@hchb.com>
This commit is contained in:
Nick Marinelli
2022-09-06 16:59:29 -04:00
parent ca2d0f560f
commit 2ecbd7cbdf
@@ -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.