create-react-app: how to use https instead of http?

后端 未结 19 1385
眼角桃花
眼角桃花 2020-12-24 10:04

I was wondering if anyone knows how to use https on dev for the \'create-react-app\' environment. I can\'t see anything about that in the README or quick googling. I just wa

19条回答
  •  余生分开走
    2020-12-24 10:55

    I think it is worth to mention to set PORT=443, default HTTPS standard port. You can avoid to attach :PORT at the end of the address every time.

    My package.json is like (tested from Ubuntu Server 18.04):

    {
      ...
      "scripts": {
        "start": "HTTPS=true PORT=443 react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      ...
    }
    

提交回复
热议问题