Webpack Dev Server running on HTTPS/Web Sockets Secure

前端 未结 6 880
無奈伤痛
無奈伤痛 2020-12-02 18:19

Normally in developer mode Webpack runs using HTTP. There is usually a web server serving content through HTTP and webpack using http/websockets on a separate port.

6条回答
  •  渐次进展
    2020-12-02 18:39

    In my case I had to run all these commands to get the certificate:

    openssl genrsa -out private.key 4096
    openssl req -new -sha256 -out private.csr -key private.key
    openssl x509 -req -days 3650 -in private.csr -signkey private.key -out private.crt -extensions req_ext
    openssl x509 -in private.crt -out private.pem -outform PEM
    

    And then finally:

    npm run dev -- --open --https --cert private.pem --key private.key
    

提交回复
热议问题