bdkjones / CodeKit2

CodeKit 2 Beta
98 stars 4 forks source link

Allow CodeKit to terminate SSL/TLS #603

Open njones opened 8 years ago

njones commented 8 years ago

I have a project that needs HTTPS in order for me to test locally. Is it possible to have an option in CodeKit to add a server .pem file and a private .key file so that CodeKit can terminate SSL and the proxy server can serve HTTPS?

The use case I have is: I'm using websockets from another domain, but those websockets must be in HTTPS (i.e. wss://websocket.example.com). This means that even though I can run my external server on my machine as HTTP, I would still need for the CodeKit proxy server to run as HTTPS. I have used my hosts file to map a domain (i.e. localhost.example.com) to localhost. So, if I could add an example.com .pem file and the corresponding private.key certificate to the CodeKit proxy server, it could serve secure https://localhost.example.com traffic. The browser could then connect to the other websocket server in the same domain securely without failing.

One way of implementing this could be: An option under "Browser Refreshing" where you could specify a server.pem file and a private.key file (or even drop in the certificate text -- eliminating an extra file), then if those fields were filled in CodeKit could use those certificates to terminate SSL for that project.

I think this may be related to issue #462

bdkjones commented 8 years ago

Yea, I mean this is definitely doable but the problem is handling the certificates. Everything in project settings must be syncable across machines; you can set a pem file path there that isn't going to exist on another Mac where the project is added. So your certificates would essentially have to be in the project.

Sent from my iPhone

On Feb 11, 2016, at 03:45, Nika Jones notifications@github.com wrote:

I have a project that needs HTTPS in order for me to test locally. Is it possible to have an option in CodeKit to add a server .pem file and a private .key file so that CodeKit can terminate SSL and the proxy server can serve HTTPS?

The use case I have is:

I'm using websockets from another domain, but those websockets must be in HTTPS (i.e. wss://websocket.example.com). This means that even though I can run my external server on my machine as HTTP, I would still need for the CodeKit proxy server to run as HTTPS. I have used my hosts file to map a domain (i.e. localhost.example.com) to localhost. So, if I could add an example.com .pem file and the corresponding private.key certificate to the CodeKit proxy server, it could serve secure https://localhost.example.com traffic. The browser could then connect to the other websocket server in the same domain securely without failing.

One way of implementing this could be:

An option under "Browser Refreshing" where you could specify a server.pem file and a private.key file (or even drop in the certificate text -- eliminating an extra file), then if those fields were filled in CodeKit could use those certificates to terminate SSL for that project.

I think this may be related to issue #462

— Reply to this email directly or view it on GitHub.

njones commented 8 years ago

FYI: Here's a small go proxy-proxy that I made to terminate SSL for my project. The defaults are for a CodeKit based project. Maybe someone else could use it too: https://gist.github.com/njones/bdcbf96699e021250d0d