localhost-ssl
v0.0.0
Published
Serve localhost files in (self-signed) SSL. Also Reload browser tab when the file changes(Run your app in first tab)
Downloads
22
Readme
#A Simple Node.js based Self-signed SSL server.
Usage:
git clone [email protected]:rajaraodv/localhost-ssl.git
CD into
localhost-ssl
and do:npm install
node app.js <path-to-the-base-folder-that-should-be-served-in-ssl>
- For example:
node app.js ~/apps/myapp
if you want to server files frommyapp
folder. - You will see the below error at first that asks you to create
server.crt
andserver.key
- You can go through the Heroku article or go through the quick steps below to create them.
-------------------------------------------- ERROR. Self signed cert and key not found! FOLLOW QUICK STEPS BELOW TO CREATE SELF SIGNED CERTS: (Note: these instructions are from this Heroku article: https://devcenter.heroku.com/articles/ssl-certificate-self) ------------------------------------------------------------ (Copy paste the below commands one by one) Step 1. openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 Step 2. openssl rsa -passin pass:x -in server.pass.key -out server.key Step 3. rm server.pass.key Step 4. openssl req -new -key server.key -out server.csr (<----- Hit Enter to accept default values or enter your own) Step 5. openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
- For example:
Run step 2 again.
Open browser and go to:
https://localhost:3000/path-to-file-inside-base-folder
(Note: this is HTTPS)- For example: If the base folder you entered earlier is: "
~/apps/myapp
and you want to access a file~/apps/myapp/test.js
, open:https://localhost:3000/test.js
(<-- HTTPS)
- For example: If the base folder you entered earlier is: "
Note: Chrome will complain that this cert is untrusted. But since this is your own localhost and if you trust it, press OK and you are ready to go.
MIT LICENSE
Copyright (c) 2011-2013 Jason Huck, Simon Georget http://opensource.org/licenses/MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.