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

Add support for manual SSL certs/keys #520

Merged
merged 1 commit into from
Sep 26, 2019
Merged

Add support for manual SSL certs/keys #520

merged 1 commit into from
Sep 26, 2019

Conversation

mattdodge
Copy link
Contributor

@mattdodge mattdodge commented Apr 5, 2019

This is the work done to address #511 that I created a while back.

Essentially, it adds two optional CLI args for providing a path to an SSL cert and private key. This allows you to create certs using another tool such as mkcert and use them in serve.

Here is a possible workflow:

$ mkcert -install
Using the local CA at "/Users/matt/Library/Application Support/mkcert" ✨
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊

$ mkcert localhost
Using the local CA at "/Users/matt/Library/Application Support/mkcert" ✨
Created a new certificate valid for the following names 📜
 - "localhost"
The certificate is at "./localhost.pem" and the key at "./localhost-key.pem" ✅

$ serve --ssl-cert ./localhost.pem --ssl-key ./localhost-key.pem

   ┌────────────────────────────────────────────────────┐
   │                                                    │
   │   Serving!                                         │
   │                                                    │
   │   - Local:            https://localhost:5000       │
   │   - On Your Network:  https://192.168.0.126:5000   │
   │                                                    │
   │   Copied local address to clipboard!               │
   │                                                    │
   └────────────────────────────────────────────────────┘

This does not do any kind of cert creation, cert validation, or automatic HTTPS - it just lets you serve with HTTPS if you happen to have certs already.

Copy link

@joeySchentrup joeySchentrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot. Adding this functionality will assist a lot of people.

@dogancana
Copy link

Any update on this? Looks ready to me :)

@IKS-Ploetzwich
Copy link

IKS-Ploetzwich commented Sep 18, 2019

This is really needed. Please review and implement.

Copy link
Contributor

@leo leo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much! This looks great.

In most cases, of course, your production environment (proxy) should be taking care of terminating the SSL setup. I do understand, however, that this can still be useful for cases where there's no proxy or for local development.

@leo leo merged commit 70d957b into vercel:master Sep 26, 2019
@leo
Copy link
Contributor

leo commented Sep 26, 2019

Out now!

@lacivert
Copy link

I believe this needs a simple note on documentation. I could find the usage agruments on cli but there is no docs on markdown pages

@Alexufo
Copy link

Alexufo commented Jul 2, 2021

must be in readme

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

Successfully merging this pull request may close these issues.