Using HTTPS in Your Development Environment

Why should you use HTTPS for development? How can you set it up? This article will explain (almost) everything.
Read more…

:writing_hand:t2: Brought to you by @andrea.chiarelli

3 Likes

What’s up Devs! How did you like this post? Please share any comments or feedback with us on this thread

1 Like

Just tried this. This is really interesting and will surely use it whenever i can, thanks @andrea.chiarelli

3 Likes

Thanks for the feedback @monalisasdaddy, we really appreciate it! :smile:

1 Like

Thank you so much for your feedback @monalisasdaddy! :pray:

2 Likes

Nice article ! it’s a good solution specially if you need to use HTTPS for a fixed domain that you have hardcoded in some place in the code and cannot change, or you just have a Node app and nothing else. But if you have other type of apps like Python or Java apps, figure out how to setup a cert on each of them is annoying, so the best way is just to setup a local reverse proxy like Nginx with the cert configured there, and in Docker times that it’s even easier.

So, with this project I made: nginx-local-ip, an existing and valid certificate is downloaded and used in a loca Nginx (with Docker), so there is no need to setup anything in the client device, you can access the app within your device or any other device within the same network with the URL that is shown in the logs at startup time, e.g. https://192-168-0-3.my.local-ip.co/

You have to know you local ip (in Linux execute ifconfig or ip addr) and set the URL and port where your app is running locally using that IP, e.g. if your app is accessible at http://192.168.0.3:5988, here is how to run the container → APP_URL=http://192.168.0.3:5988 docker-compose up . Check the instruction in the README.

Moreover, a “real” public cert is needed if you want to access your app in a mobile device, at least in Android, where you cannot change the cert configurations easily, specially if you have a HTML5 app embedded in a Webview Android app, that requires any content loaded in the webview to be serve with HTTPS using a valid cert.

Thanks for sharing that with the rest of community @mrsarm !

1 Like

I just released lodev, single binary that provides easy setup for local development env with SSL (HTTPS).
It will create local CA, install it as a trusted CA and generate certificate and key. Spin up small DNS server that is used only to resolve dev.lo domain and create reverse proxy on port 443 under https://dev.lo domain and by default proxy all requests to http://localhost:3000, target port can be changed.

1 Like