Your solution generates a certificate and leaves it up to the user to setup https.<p>There are other steps involved, like adding the cert to the trust store (so you don't get invalid SSL warnings). And also changing your application code to use these certificates.<p>Even if you do that, you are still exposed to a serious security threat: if a bad actor gets hold of your certificate file, they can pose as a legitimate website and steal sensitive data. This security flaw is present with all other script solutions mentioned in this thread.<p>To overcome these issues, I have built a mac application called HTTPSLocalhost (<a href="https://httpslocalhost.com" rel="nofollow">https://httpslocalhost.com</a>).<p>- It offers a user interface to add remove local https domains<p>- Has an inbuilt proxy so you don't need to change your application code<p>- Is much safer because it deletes the certificate and private keys as soon as the proxy server starts<p>- It creates a new certificate each time you start the app, to enhance security.<p>- And of course, like all good things, is free (there is a video demo on the website, the app will be ready soon).<p>Wanted to do a proper Show HN next week, but I guess it's the right time to bring it up :)<p>Thanks