{"id":13990789,"url":"https://github.com/berstend/straightforward","last_synced_at":"2026-03-04T11:32:37.756Z","repository":{"id":57371656,"uuid":"137640927","full_name":"berstend/straightforward","owner":"berstend","description":"🏴 A straightforward forward-proxy written in Node.js.","archived":false,"fork":false,"pushed_at":"2024-04-27T09:37:52.000Z","size":104,"stargazers_count":84,"open_issues_count":6,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-11T07:13:55.830Z","etag":null,"topics":["forward-proxy","https","https-proxy","nodejs","proxy","squid"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/berstend.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":"2018-06-17T08:48:44.000Z","updated_at":"2025-05-28T01:35:42.000Z","dependencies_parsed_at":"2024-08-09T13:21:41.411Z","dependency_job_id":null,"html_url":"https://github.com/berstend/straightforward","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.4375,"last_synced_commit":"84a4cb88024cffce37a05870da7d9d0aba7dcca8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/berstend/straightforward","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berstend%2Fstraightforward","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berstend%2Fstraightforward/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berstend%2Fstraightforward/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berstend%2Fstraightforward/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berstend","download_url":"https://codeload.github.com/berstend/straightforward/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berstend%2Fstraightforward/sbom","scorecard":{"id":234573,"data":{"date":"2025-08-11","repo":{"name":"github.com/berstend/straightforward","commit":"84a4cb88024cffce37a05870da7d9d0aba7dcca8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"42 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-3mv9-4h5g-vhg3","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-7jxr-cg7f-gpgv","Warn: Project is vulnerable to: GHSA-xj72-wvfv-8985","Warn: Project is vulnerable to: GHSA-ch3r-j5x3-6q2m","Warn: Project is vulnerable to: GHSA-p5gc-c584-jj6v","Warn: Project is vulnerable to: GHSA-whpj-8f3w-67p5","Warn: Project is vulnerable to: GHSA-cchq-frgv-rjh5","Warn: Project is vulnerable to: GHSA-g644-9gfx-q4q4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T05:23:44.751Z","repository_id":57371656,"created_at":"2025-08-17T05:23:44.751Z","updated_at":"2025-08-17T05:23:44.751Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["forward-proxy","https","https-proxy","nodejs","proxy","squid"],"created_at":"2024-08-09T13:03:14.867Z","updated_at":"2026-03-04T11:32:37.713Z","avatar_url":"https://github.com/berstend.png","language":"TypeScript","readme":"# 🏴 straightforward ![npm bundle size](https://img.shields.io/bundlephobia/min/straightforward) [![ ](https://img.shields.io/npm/v/straightforward.svg)](https://www.npmjs.com/package/straightforward)\n\n\u003ca href=\"https://github.com/berstend/straightforward\"\u003e\u003cimg src=\"https://i.imgur.com/B9KXKGS.jpg\" width=\"214px\" height=\"790px\" align=\"right\" /\u003e\u003c/a\u003e\n\n\u003e A straightforward forward-proxy written in Node.js\n\n## Goals\n\n- Extremely focused (~200 SLOC), no-fuzz **forward proxy**\n- **Support HTTP, HTTPS, CONNECT \u0026 Websockets** (wss)\n- Performant: By default all requests/responses are streamed\n- No external dependencies, small, self-contained, tested\n- Support both cli and extensible programmatic usage\n- Straightforward: no implicit magic or abstractions\n\n### What you can do with it\n\n- Start an explicit forwarding proxy in seconds that just works\n- Optionally use authentication\n- Mock responses to test code using a proxy\n- Allow others to surf with your IP address\n- Use it programmatically to do whatever you want\n\n### What this is not\n\n- A [ssl-intercepting] proxy (https can be filtered but not modified)\n- A [reverse proxy to load-balance stuff] to internal servers\n- A [general purpose webserver] framework\n- A [proxy middleware] for express\n- A [transparent] forward proxy\n- A [caching] proxy\n- A [sni] proxy\n\n[ssl-intercepting]: https://mitmproxy.org/\n[reverse proxy to load-balance stuff]: https://github.com/nodejitsu/node-http-proxy\n[general purpose webserver]: https://github.com/fastify/fastify\n[proxy middleware]: https://github.com/villadora/express-http-proxy\n[transparent]: https://wiki.alpinelinux.org/wiki/Setting_up_Explicit_Squid_Proxy#transparent_forward_proxy\n[caching]: https://www.linuxlinks.com/webcaches/\n[sni]: https://github.com/jornane/node-snip\n\n## Installation\n\n```bash\n# Use directly with no installation (npx is part of npm):\n❯❯❯ npx straightforward --port 9191\n\n# Or install globally:\n❯❯❯ npm install -g straightforward\n```\n\n## Usage (cli)\n\n```bash\n❯❯❯ straightforward --help\n\nUsage: straightforward --port 9191 [options]\n\nOptions:\n      --version        Show version number                             [boolean]\n  -p, --port           Port to bind on                  [number] [default: 9191]\n  -a, --auth           Enable proxy authentication                      [string]\n  -e, --echo           Enable echo mode (mock all http responses)      [boolean]\n  -d, --debug          Enabled debug output                            [boolean]\n  -c, --cluster        Run a cluster of proxies (using number of CPUs) [boolean]\n      --cluster-count  Specify how many cluster workers to spawn        [number]\n  -q, --quiet          Suppress request logs                           [boolean]\n  -s, --silent         Don't print anything to stdout                  [boolean]\n  -h, --help           Show help                                       [boolean]\n\nExamples:\n  straightforward --auth \"user:pass\"  Require authentication\n  straightforward --echo              Mock responses for all http requests\n\nUse with cURL:\n  curl --proxy https://localhost:9191 'http://example.com' -v\n  curl --proxy https://user:pass@localhost:9191 'http://example.com' -v\n```\n\n## Usage (code)\n\n```js\n// ESM/TS: import { Straightforward, middleware } from \"straightforward\"\nconst { Straightforward, middleware } = require(\"straightforward\")\n\n;(async () =\u003e {\n  // Start proxy server\n  const sf = new Straightforward()\n  await sf.listen(9191)\n  console.log(`Proxy listening on http://localhost:9191`)\n\n  // Log http requests\n  sf.onRequest.use(async ({ req, res }, next) =\u003e {\n    console.log(`http request: ${req.url}`)\n    // Note the common middleware pattern, use `next()`\n    // to pass the request to the next handler.\n    return next()\n  })\n\n  // Log connect (https) requests\n  sf.onConnect.use(async ({ req }, next) =\u003e {\n    console.log(`connect request: ${req.url}`)\n    return next()\n  })\n\n  // Use built-in middleware for authentication\n  sf.onRequest.use(middleware.auth({ user: \"bob\", pass: \"alice\" }))\n  sf.onConnect.use(middleware.auth({ user: \"bob\", pass: \"alice\" }))\n\n  // Use built-in middleware to mock responses for all http requests\n  sf.onRequest.use(middleware.echo)\n})()\n```\n\n## In action\n\n```bash\n❯❯❯ straightforward --port 9191\n```\n\n![foobar](https://i.imgur.com/ZOxVhxE.png)\n\n## Example: Secure proxy on fresh server in 30 seconds\n\nLet's say you have a fresh linux server and want to use it as an authenticated forward proxy quickly.\n\n- Make sure [nvm](https://github.com/creationix/nvm#install-script) is installed:\n  - `curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash`\n- Make sure a recent version of Node.js is installed:\n  - `nvm install node \u0026\u0026 nvm use node \u0026\u0026 node --version`\n- Add [forever](https://www.npmjs.com/package/forever) (process manager) and straightforward:\n  - `npm install -g forever straightforward`\n- Start proxy daemon:\n  - `forever start --id \"proxy1\" $( which straightforward ) --port 9191 --quiet --auth 'user:foobar'`\n- Test your proxy from a different machine:\n  - `curl --proxy http://user:foobar@SERVER:9191/ http://canhazip.com`\n- List all running forever services:\n  - `forever list`\n- Stop our proxy service daemon:\n  - `forever stop proxy1`\n\n## API\n\n### onRequest\n\nMiddlewares triggered when http requests occur\n\n```js\nsf.onRequest.use(async ({ req, res }, next) =\u003e {\n  console.log(`http request: ${req.url}`)\n  // Note the common middleware pattern, use `next()`\n  // to pass the request to the next handler.\n  return next()\n})\n```\n\nMiddlwares can be chained:\n\n```js\nsf.onRequest.use(\n  async ({ req, res }, next) =\u003e {\n    console.log(`middleware1`)\n    return next()\n  },\n  async ({ req, res }, next) =\u003e {\n    console.log(`middleware2`)\n    res.writeHead(200, { \"Content-Type\": \"text/html; charset=utf-8\" })\n    res.end(\"Hello world\")\n  }\n)\n```\n\n### onResponse\n\nMiddlewares triggered when http request responses are available\n\n```js\nsf.onResponse.use(async ({ req, res, proxyRes }, next) =\u003e {\n  console.log(`http response`)\n  return next()\n})\n```\n\n### onConnect\n\nMiddlewares triggered when https and wss requests occur\n\n```js\nsf.onConnect.use(async ({ req, clientSocket, head }, next) =\u003e {\n  console.log(`connect request`)\n  return next()\n})\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberstend%2Fstraightforward","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberstend%2Fstraightforward","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberstend%2Fstraightforward/lists"}