Skip to content

update pfx and passphrase information #1594

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

Closed
wants to merge 2 commits into from

Conversation

navarrorc
Copy link

@navarrorc navarrorc commented Sep 13, 2017

Spent several hours trying to figure out why it didn't work, realized that the documentation was not accurately showing the correct information. I reviewed https://nodejs.org/api/https.html and figured out the correct way to assign these two values. I hope that saves others hours of frustration. Thanks.

Spent several hours trying to figure out why it didn't work, realized that the documentation was not accurately showing the correct information. I reviewed https://nodejs.org/api/https.html and figured out the correct way to assign these two values. I hope that saves others hours of frustration. Thanks.
@jsf-clabot
Copy link

jsf-clabot commented Sep 13, 2017

CLA assistant check
All committers have signed the CLA.

@skipjack
Copy link
Collaborator

@shellscape can you review? Happy to merge but I'd like to confirm with someone who is more familiar with advanced webpack-dev-server usage.

@shellscape
Copy link
Contributor

You can specify the pfx and passphrase options like that, but it's not required when options.https is set to true. You can see this in action here https://github.com/webpack/webpack-dev-server/blob/master/lib/Server.js#L360-L371. So I'm really not sure how we should document this. Should we have the docs say that options.https should be true, or should we encourage people to specify an object for that parameter?

@navarrorc
Copy link
Author

@shellscape The certificate is not trusted when just setting options.https to true. In my instance I followed your suggestion where you recommend creating and managing my own certificates (https://github.com/webpack/webpack-dev-server/tree/master/examples/https).

I created my own pfx and loaded it to the Trusted Root Certification Authority under my user account in Windows 10, now the browsers (IE & Chrome) trust my self-signed certificate. I would think we should continue to encourage people to create their own certificates. I don't know how common it is for people to run the WDS in https, I had to do this for my workflow to work as intended.

@navarrorc
Copy link
Author

@shellscape Thanks for clarifying, I understand now. However, setting pfx: '/path/to/file.pfx' doesn't work in my environment, I have to use fs as follows: pfx: fs.readFileSync('/path/to/file.pfx'). Can you verify that this is correct?

My options are:

...
https: true,
pfx: fs.readFileSync('/path/to/file.pfx'),
pfxPassphrase: 'passphrase'

@shellscape
Copy link
Contributor

@navarrorc I'd say that's correct. if we look at the CLI for webpack-dev-server, it's doing the same: https://github.com/webpack/webpack-dev-server/blob/master/bin/webpack-dev-server.js#L315

So for the CLI, just providing the relative path should be enough. For using the API directly, reading the file contents is needed. This is one of many discrepancies between the API and CLI that have crept into the project over the years.

@skipjack skipjack mentioned this pull request Sep 15, 2017
@skipjack
Copy link
Collaborator

Closing, as I actually think #1595 resolves this issue quite nicely. @navarrorc @shellscape please correct me if I'm wrong or feel free to submit a follow up pr with more to elaborate.

@skipjack skipjack closed this Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants