forked from facebook/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Look for HTTPS environment variable (facebook#430)
With the HTTPS env var set 'true', the dev server will serve over HTTPS.
- Loading branch information
Showing
2 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ You can find the most recent version of this guide [here](https://github.com/fac | |
- [Adding Custom Environment Variables](#adding-custom-environment-variables) | ||
- [Integrating with a Node Backend](#integrating-with-a-node-backend) | ||
- [Proxying API Requests in Development](#proxying-api-requests-in-development) | ||
- [Using HTTPS in Development](#using-https-in-development) | ||
- [Adding `<link>` and `<meta>` Tags](#adding-link-and-meta-tags) | ||
- [Referring to Static Assets from `<link href>`](#referring-to-static-assets-from-link-href) | ||
- [Generating Dynamic `<meta>` Tags on the Server](#generating-dynamic-meta-tags-on-the-server) | ||
|
@@ -528,6 +529,30 @@ If the `proxy` option is **not** flexible enough for you, alternatively you can: | |
* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)). | ||
* Use [environment variables](#adding-custom-environment-variables) to inject the right server host and port into your app. | ||
## Using HTTPS in Development | ||
>Note: this feature is available with `[email protected]` 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.) | ||
#### Linux, OS X (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. | ||
## Adding `<link>` and `<meta>` Tags | ||
You can edit the generated `index.html` and add any tags you’d like to it. | ||
|