mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
Document how to use the .env file to enforce HTTPS (#7821)
This commit is contained in:
committed by
Ian Sutherland
parent
dc4d62d019
commit
ab41c4c5c5
@@ -31,3 +31,14 @@ HTTPS=true npm start
|
||||
```
|
||||
|
||||
Note that the server will use a self-signed certificate, so your web browser will almost definitely display a warning upon accessing the page.
|
||||
|
||||
To avoid having to set the environment variable each time, you can either include in the `npm start` script like so:
|
||||
|
||||
```json
|
||||
{
|
||||
"start": "HTTPS=true react-scripts start"
|
||||
}
|
||||
```
|
||||
|
||||
Or you can create a `.env` file with `HTTPS=true` set.
|
||||
[Learn more about environment variables in CRA](https://create-react-app.dev/docs/adding-custom-environment-variables).
|
||||
|
||||
Reference in New Issue
Block a user