Skip to content

Instantly share code, notes, and snippets.

@andrewn
Last active July 1, 2018 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewn/953ffd5cb17ac2634dc969fc7bdaff3f to your computer and use it in GitHub Desktop.
Save andrewn/953ffd5cb17ac2634dc969fc7bdaff3f to your computer and use it in GitHub Desktop.
Testing SSL (self-signed cert)

Easy option (self-signed cert)

  1. Install local-ssl-proxy:

    npm install local-ssl-proxy

  2. Start local-ssl-proxy on port 443:

    sudo local-ssl-proxy --source 443 --target 80

  3. Set API to point to HTTPS by changing .env:

    API_URL=https://localhost/api

  4. Start HTTP client on port 80 (edit .env to set PORT=80)

    sudo npm start

  5. You must visit the secure endpoint in your browser and accept the self-signed certificate. In Chrome, visit https://localhost/, click "ADVANCED" and then "Proceed to localhost (unsafe)".

  6. Then the HTTP endpoint at http://localhost/ will be able to make Ajax requests through the HTTPS proxy.

@jareddonovan
Copy link

Hi - I found that I needed to install local-ssl-proxy globally (not as a local package) for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment