{"id":20111987,"url":"https://github.com/vexcited/surfonxy","last_synced_at":"2026-01-04T08:33:33.544Z","repository":{"id":243295368,"uuid":"714366082","full_name":"Vexcited/Surfonxy","owner":"Vexcited","description":"An experimental client-side focused Node.js web proxy.","archived":false,"fork":false,"pushed_at":"2024-06-07T19:37:44.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T22:51:46.970Z","etag":null,"topics":["nodejs","typescript","web-proxy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vexcited.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":"2023-11-04T17:37:02.000Z","updated_at":"2024-12-02T18:08:46.000Z","dependencies_parsed_at":"2024-06-07T21:55:42.629Z","dependency_job_id":null,"html_url":"https://github.com/Vexcited/Surfonxy","commit_stats":null,"previous_names":["vexcited/surfonxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FSurfonxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FSurfonxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FSurfonxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FSurfonxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vexcited","download_url":"https://codeload.github.com/Vexcited/Surfonxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245001865,"owners_count":20545321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["nodejs","typescript","web-proxy"],"created_at":"2024-11-13T18:18:27.805Z","updated_at":"2026-01-04T08:33:33.450Z","avatar_url":"https://github.com/Vexcited.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Surfonxy\n\n\u003e An experimental home made, ~~[Bun](https://bun.sh) optimized~~ Node (since there's some issues with Bun, see below), web proxy.\n\n## Issues with Bun\n\nThe following issues are preventing us from 100% supporting Bun as of right now.\n\n- \u003chttps://github.com/oven-sh/bun/issues/5556\u003e\n- \u003chttps://github.com/oven-sh/bun/issues/4529\u003e\n\n## Motivation\n\nTo finally provide a *well working*, easy to use, ad-free and completely transparent web proxy to humanity.\n\nSince it's in heavy development, the \"well working\" part is a bit wrong, but it'll improve over time !\n\n## Methods used to proxy\n\nWe use different methods to proxy every requests that are done in the client.\n\n### Monkey patching\n\nRequired for [WebSocket](https://developer.mozilla.org/docs/Web/API/WebSocket) and much more prototypes such as MessageEvent.\n\nWe also use this to proxy/intercept some methods like `document.URI`, `document.referrer`, `window.open`, ...\n\n### Service Worker\n\nThis one is used to intercept every possible requests and rewrite the URL before sending it.\nThat way, we're sure that everything is requested to our proxy.\n\nThere's a placeholder page that can be triggered when adding the `__sf_register=1` search parameter to any URL. This page installs the service-worker and redirects the user to the desired page when done.\n\n### Server-side tweaking\n\nWe rewrite HTML documents when they're requested server-side. That way we can pre-patch some elements, for example `\u003ca\u003e` elements, before sending them to the client.\n\nWe also tweak JS scripts, to rewrite every `location` to `__sfLocation`. That allows to proxy the `window.location` property.\n\n\u003c!-- TODO: Add `postMessage`s and `import`s  --\u003e\n\n\u003c!-- TODO: Add workers --\u003e\n\n## Development\n\nSince we use Node, we use `pnpm` as the main package manager. You can install it using `npm i -g pnpm`.\n\nEven though, some scripts will use Bun (such as the `bun:tests` one). You can still run them using `pnpm`, it's fine.\n\n### Commands\n\n| Command | Description |\n| ------- | ----------- |\n| `pnpm lint` | Lints the codebase using `eslint`. |\n| `pnpm node:start` | Starts the proxy with HTTPS on port `443` **with Node** (using [`tsx`](https://www.npmjs.com/package/tsx)) |\n| `pnpm bun:start` | Starts the proxy with HTTPS on port `443` **with Bun** directly (kinda broken for now) |\n| `pnpm bun:tests` | Run the simple sandbox *test* server from [`./tests`](./tests/) on the port `8000`. |\n\n### Build the `https` certificate for local `surfonxy.dev`\n\n\u003e Extracted from \u003chttps://web.dev/how-to-use-local-https/#running-your-site-locally-with-https-using-mkcert-recommended\u003e\n\u003e\n\u003e Note that these steps needs to be done on the Windows side if you're running under WSL2.\n\nFirst, install [`mkcert`](https://github.com/FiloSottile/mkcert/releases).\n\nRun `mkcert -install` and restart your browser(s) if needed.\n\nThen, we're going to add `surfonxy.dev` in our `/etc/hosts` file (or `C:\\Windows\\System32\\drivers\\etc\\hosts` on Windows)\n\nHere's a one-liner for Linux users :\n\n```bash\necho \"127.0.0.1 surfonxy.dev\" | sudo tee -a /etc/hosts\n\n# or this if you're already root, no sudo needed.\necho \"127.0.0.1 surfonxy.dev\" | tee -a /etc/hosts\n```\n\nOtherwise on Windows, you can open the file with Notepad (`notepad C:\\Windows\\System32\\drivers\\etc\\hosts` in Administrator) and add the following line :\n\n```hosts\n127.0.0.1 surfonxy.dev\n```\n\nFinally, we're going to create a certificate for this host, using `mkcert surfonxy.dev`.\n\nYou'll see two new files in your current directory, `surfonxy.dev.pem` and `surfonxy.dev-key.pem`.\n\nMove them in this `example` directory. On WSL2, you just drag the created certificates into the `example` folder.\n\nYou're now ready ! You can run `pnpm node:start` and go to \u003chttps://surfonxy.dev\u003e to see the test server running.\n\n### Using `certbot` when deploying\n\n\u003e Extracted from \u003chttps://certbot.eff.org/instructions?ws=other\u0026os=ubuntufocal\u0026tab=standard\u003e\n\nYou must have `snap` installed on your server.\n\n```bash\nsudo snap install --classic certbot\nsudo ln -s /snap/bin/certbot /usr/bin/certbot\nsudo certbot certonly --standalone\n\n# =\u003e later renew using\nsudo certbot renew --dry-run\n```\n\nThe certificates will be ...\n\n- `/etc/letsencrypt/live/example.com/fullchain.pem` -\u003e `surfonxy.dev.pem`\n- `/etc/letsencrypt/live/example.com/privkey.pem` -\u003e `surfonxy.dev-key.pem`\n\nCopy them ...\n\n```bash\nsudo cp /etc/letsencrypt/live/example.com/fullchain.pem ./surfonxy.dev.pem\nsudo cp /etc/letsencrypt/live/example.com/privkey.pem ./surfonxy.dev-key.pem\n```\n\nDone !\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvexcited%2Fsurfonxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvexcited%2Fsurfonxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvexcited%2Fsurfonxy/lists"}