{"id":26514698,"url":"https://github.com/bwajtr/https-on-localhost-how-to","last_synced_at":"2026-04-14T03:31:52.211Z","repository":{"id":223257946,"uuid":"759712057","full_name":"bwajtr/https-on-localhost-how-to","owner":"bwajtr","description":"How to easily test any localhost website using a valid HTTPS protocol (run nginx SSL termination on a developer machine using docker compose)","archived":false,"fork":false,"pushed_at":"2024-02-19T08:41:37.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-19T04:07:52.468Z","etag":null,"topics":["docker-compose","localhost","mkcert","nginx","reverse-proxy","ssl-certificates","ssl-termination"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwajtr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T07:35:06.000Z","updated_at":"2024-02-19T09:02:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e74cb92-fc7e-4d3f-8319-6f0bd7fe99a8","html_url":"https://github.com/bwajtr/https-on-localhost-how-to","commit_stats":null,"previous_names":["bwajtr/https-on-localhost-how-to"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bwajtr/https-on-localhost-how-to","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwajtr%2Fhttps-on-localhost-how-to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwajtr%2Fhttps-on-localhost-how-to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwajtr%2Fhttps-on-localhost-how-to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwajtr%2Fhttps-on-localhost-how-to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwajtr","download_url":"https://codeload.github.com/bwajtr/https-on-localhost-how-to/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwajtr%2Fhttps-on-localhost-how-to/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31781292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","localhost","mkcert","nginx","reverse-proxy","ssl-certificates","ssl-termination"],"created_at":"2025-03-21T05:29:05.920Z","updated_at":"2026-04-14T03:31:52.196Z","avatar_url":"https://github.com/bwajtr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## How to easily test any localhost website using a valid HTTPS protocol\n\n### What is this about?\n\nYou typically develop webapps using HTTP protocol, because it's simple to run and use e.g. on http://localhost:8080\nBut the app might behave differently when running using HTTPS in production.\nBelow are fairly simple steps that are needed to set up HTTPS protocol (HTTP/2 actually) for your webapp testing locally.\n\nAdvantages of the below approach: \n  - you don't have to change anything in your app at all\n  - the app is still accessible on http://localhost:8080 - so you can test it using HTTP and HTTPS at the same time\n  - it mimics a typical production setup, where the SSL termination is done before the request even reaches your app\n\n### How it works?\n\nWe use `mkcert` tool to generate (and install) self-signed SSL certificates so your browser will trust them.\nThen we use `docker compose` to startup `nginx` local server running on https://secure.localhost that will use those\ncertificates and simply redirect all traffic to your local webapp running on http://localhost:8080. In technical terms the `nginx` server\nwill perform SSL termination and acts as a reverse proxy to your local webapp. \n\n### How to run it?\n\n1. Clone this repository locally\n2. Install Docker Desktop\n3. Install mkcert (https://github.com/FiloSottile/mkcert#installation)\n    - this is a tool that we will use to generate certificates required to run HTTPS locally\n    - Note that it's not safe to share these certificates, it's better to generate them on your own\n    - see this article for more details: https://web.dev/articles/how-to-use-local-https\n4. Go to `nginx/certs/` and run `generate-certs.sh` there (this is required just once)\n    - It will probably require your system admin password, so it can add generated root CA certificate to your system\n    - `cert.pem` and `key.pem` should be generated in `nginx/certs/` directory\n    - You may need to restart your browsers to changes to take effect\n5. Run your webapp (so it is available at http://localhost:8080)\n6. Run `docker compose up` in the root directory of this repository\n    - HTTPS proxy is now running, accessible at https://secure.localhost, it redirects all traffic to http://localhost:8080\n7. You can now keep docker compose running, you can restart your application as you like\n8. When you are done, run `docker compose down` to stop the proxy   \n\n### Troubleshooting\n\n* I see `502 Bad Gateway` instead of my website\n    - Make sure your webapp is running on http://localhost:8080","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwajtr%2Fhttps-on-localhost-how-to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwajtr%2Fhttps-on-localhost-how-to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwajtr%2Fhttps-on-localhost-how-to/lists"}