Skip to content
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 make HTTPS work #32

Open
rodrigopolo opened this issue Aug 16, 2013 · 0 comments
Open

How to make HTTPS work #32

rodrigopolo opened this issue Aug 16, 2013 · 0 comments

Comments

@rodrigopolo
Copy link

Instructions to make the example work on HTTPS

Everything should be done on Command Prompt or PowerShell as an administrator

  1. Set the path for makecert
SET PATH=%PATH%;C:\Program Files (x86)\Windows Kits\8.0\bin\x64\
  1. Create a self-signed X.509 certificate
makecert -sr LocalMachine -ss My -pe -n "CN=mydomain.me" -a sha256 -len 1024 -r
  1. Locate certificate and get the certhash.

    • Run "mmc" as an administrator.
    • Click on "file" menu, then select on the list of "Available snap-ins" the "Certificates" and press the button "Add".
    • Select "Computer account" on the new window and click on the "next" button.
    • Select "Local computer" and click the "Finish" button.
    • Clic on the "Ok" button.
    • Go to the "Console Root->"Certificates (Local Computer)">-"Personal"->"Certificates" folder.
    • Double click on the certificate you just created (CN=mydomain.com)
    • Click on "Details" tab
    • Scroll to see the thumbprint select and copy
  2. Register this certificate to be used by HTTP.SYS for all connections made on the TCP port on which you intend to set up the HTTPS server, remove white spaces from the thumbprint you just copied, BTW it is case sensitive, leve it as it is, just remove the white spaces, the appid parameter is an arbitrary GUID.

    netsh http add sslcert ipport=0.0.0.0:8080 certhash=73abd3c3ac5fd7ff867fe6255207fa1528cee7a1 appid={00112233-4455-6677-8899-AABBCCDDEEFE}
  3. Verify the certificate is properly installed

    netsh http show sslcert ipport=0.0.0.0:8080
  4. Finally, author your HTTPS server:

    require('httpsys').slipstream(); 
    
    var https = require('https');
    var options = {};
    
    https.createServer(options, function (req, res) {
     res.writeHead(200, { 'Content-Type': 'text/plain' });
     res.end('Hello, world!');
    }).listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant