-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to start https server with SSL cert? #1411
Comments
The development serverYou can't currently, The better question is why do you want to pass a specific certificate for your dev server? You're not really gaining much other than identity verification (which you're in control of the server so you know the identity). The self-signed default certificate it uses may not be "valid" but will still encrypt the data in transit which will protect the data if your dev server is across an untrusted network. The production serverSee the discussion in #1409 for details about HTTPs in production. |
I’m going to close since it doesn’t seem really necessary in DEV, and it would either require configuration, or having some sort of convention for the filenames of the cert. If you feel strongly about this feel free to send a PR that uses a filename convention for them, and we can review it. |
I'm surprised this was closed. Two-way client authentication is a typical part of our webapp's security design. And create-react-app does a lot to make developers' lives easier, so getting rid of the pesky security error would be nice. Our particular use case is:
So part of our development includes writing/testing the code that handles (3) above. This is not currently possible using the dev server. |
Can you raise a new issue and describe your proposal in more detail? It's not clear to me what we should do to enable this. We do support |
You're right my above comment wasn't clear and was conflating the original request with 2-way authentication. I've submitted #2759. |
I have the same issue, I need to pass a certificate file in to webpackDevServer like so
|
I'm running into this in dev as well. The use case is using some web services that use HTTPS, and browsers not allowing HTTP and HTTPS to be mixed on the same page for security reasons. |
@disaacson check out the epic hack I found to get this working #2759 (comment) |
The Use-Case: Developing a webapp that uses websockets. Websockets will be declined by chrome with unsecure self-signed certificates. |
I just made this change to before- const devServer = new WebpackDevServer(compiler, serverConfig); after- const devServer = new WebpackDevServer(compiler, {
...serverConfig,
https: true
}); Webpack dev server creates the certificate. Just navigate to https://localhost:3000, allow chrome to visit the site and you're good to go. It goes without saying that this is not a good practice. But a quick fix. |
Looked at the code and it seems to be sensitive to an environment variable called HTTPS. |
+1 for
|
You will need to save your certificate as a pem file with the name server.pem into your node_modules/webpack-dev-server/ssl Hope this helps |
if you run chrome enabling this seems to work
|
Why was this closed? |
I used following in start.js
and in WebpackDevServer
|
@roniger solution is great, thanks. |
Hi,
I am able to start the https server in windows using set HTTPS=true&&npm start.
Is it possible to pass the SSL cert and key to the https server?
e.g. for node http-server, I can start the https server with
http-server S -C c:\cert\server.pem -K c:\cert\server.key.
How do I achieve the same result for create-react-app?
The text was updated successfully, but these errors were encountered: