{"id":16682614,"url":"https://github.com/jchip/mitm-proxy","last_synced_at":"2026-04-20T16:33:31.386Z","repository":{"id":66137364,"uuid":"249276230","full_name":"jchip/mitm-proxy","owner":"jchip","description":"demo and testing with mitm http proxy in node.js","archived":false,"fork":false,"pushed_at":"2020-03-22T23:05:20.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T15:15:16.169Z","etag":null,"topics":["http","https","mitm","nodejs","proxy","ssl"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-03-22T21:32:10.000Z","updated_at":"2020-03-22T23:06:21.000Z","dependencies_parsed_at":"2023-03-23T23:32:49.641Z","dependency_job_id":null,"html_url":"https://github.com/jchip/mitm-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jchip/mitm-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fmitm-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fmitm-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fmitm-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fmitm-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchip","download_url":"https://codeload.github.com/jchip/mitm-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fmitm-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32055370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["http","https","mitm","nodejs","proxy","ssl"],"created_at":"2024-10-12T14:08:05.267Z","updated_at":"2026-04-20T16:33:31.361Z","avatar_url":"https://github.com/jchip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mitm-proxy\n\ndemo and testing with mitm http proxy in node.js\n\nThese instructions are for MacOS, verified on macOS Mojave version 10.14.6\n\n## Create SSL certs\n\n- Prepare `certs` dir\n\n```bash\nmkdir certs\ncd certs\n```\n\n- dev.myserver.com\n\n```bash\nopenssl req -new -x509 -nodes -sha256 -days 3650 \\\n -newkey rsa:2048 -out dev-server.crt -keyout dev-server.key \\\n -extensions SAN -reqexts SAN -subj /CN=dev.myserver.com \\\n -config \u003c(cat /etc/ssl/openssl.cnf \\\n    \u003c(printf '[ext]\\nbasicConstraints=critical,CA:TRUE,pathlen:0\\n') \\\n    \u003c(printf '[SAN]\\nsubjectAltName=DNS:dev.myserver.com,IP:127.0.0.1\\n'))\n```\n\n- dev.mydomain.com (proxy)\n\n```bash\nopenssl req -new -x509 -nodes -sha256 -days 3650 \\\n -newkey rsa:2048 -out dev-proxy.crt -keyout dev-proxy.key \\\n -extensions SAN -reqexts SAN -subj /CN=dev.mydomain.com \\\n -config \u003c(cat /etc/ssl/openssl.cnf \\\n    \u003c(printf '[ext]\\nbasicConstraints=critical,CA:TRUE,pathlen:0\\n') \\\n    \u003c(printf '[SAN]\\nsubjectAltName=DNS:dev.mydomain.com,IP:127.0.0.1\\n'))\n```\n\n## Register certs in System keychain\n\n- dev.myserver.com\n\n```bash\nsudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dev-server.crt\n```\n\n- dev.mydomain.com (proxy)\n\n```bash\nsudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dev-proxy.crt\n```\n\n## Testing\n\n### http to https\n\n```bash\nnode http-to-https\n```\n\nPoint browser to `http://localhost:3000`\n\nYou should see Google's homepage\n\n### https to https\n\n```bash\nnode https-to-https\n```\n\nPoint browser to `https://dev.mydomain.com`\n\nYou should see Google's homepage\n\n### https to https with self signed certs\n\n1. In one terminal, start the server\n\n```\nnode server.js\n```\n\n2. In another terminal, start the proxy\n\n```bash\nnode https-to-https-with-self-certs.js\n```\n\nNow point browser to `https://dev.mydomain.com/hello`.\n\nYou should get back `\"hello world\"`.\n\n- custom client CA\n\nTo avoid node.js throwing `Error: self signed certificate`, these tests specified the `ca` option in target to use the self signed certificate for CA.\n\nAnother way is to add the self signed cert to node.js CA store:\n\n```bash\nNODE_EXTRA_CA_CERTS=${PWD}/certs/dev-server.crt node https-to-https-with-self-certs.js\n```\n\n## Misc: Generate PKCS12 file\n\nTo generate [PKCS12](https://en.wikipedia.org/wiki/PKCS_12) file from certificate key/cert files:\n\n```bash\nopenssl pkcs12 -export -out dev-server.pfx -inkey dev-server.key -in dev-server.crt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fmitm-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchip%2Fmitm-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fmitm-proxy/lists"}