mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-01 12:42:50 +08:00
Move using https in development to its own file
This commit is contained in:
32
docusaurus/docs/using-https-in-development.md
Normal file
32
docusaurus/docs/using-https-in-development.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
id: using-https-in-development
|
||||
title: Using HTTPS in Development
|
||||
---
|
||||
|
||||
> Note: this feature is available with `react-scripts@0.4.0` and higher.
|
||||
|
||||
You may require the dev server to serve pages over HTTPS. One particular case where this could be useful is when using [the "proxy" feature](#proxying-api-requests-in-development) to proxy requests to an API server when that API server is itself serving HTTPS.
|
||||
|
||||
To do this, set the `HTTPS` environment variable to `true`, then start the dev server as usual with `npm start`:
|
||||
|
||||
#### Windows (cmd.exe)
|
||||
|
||||
```cmd
|
||||
set HTTPS=true&&npm start
|
||||
```
|
||||
|
||||
(Note: the lack of whitespace is intentional.)
|
||||
|
||||
#### Windows (Powershell)
|
||||
|
||||
```Powershell
|
||||
($env:HTTPS = $true) -and (npm start)
|
||||
```
|
||||
|
||||
#### Linux, macOS (Bash)
|
||||
|
||||
```bash
|
||||
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.
|
||||
Reference in New Issue
Block a user