{"id":23552746,"url":"https://github.com/rhildred/cors-proxy2","last_synced_at":"2026-04-28T17:35:36.625Z","repository":{"id":173396879,"uuid":"640022413","full_name":"rhildred/cors-proxy2","owner":"rhildred","description":"simplified to run as a cloudflare pages function or express app","archived":false,"fork":false,"pushed_at":"2023-06-14T16:53:18.000Z","size":253,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-21T09:56:44.436Z","etag":null,"topics":["cloudflare-pages","cors","functions","github","http-proxy","isomorphic-git","proxy","stackblitz"],"latest_commit_sha":null,"homepage":"https://rhildred.github.io/cors-proxy2","language":"JavaScript","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/rhildred.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-05-12T19:35:25.000Z","updated_at":"2023-10-16T03:02:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"cdd1ff40-c537-430c-bd13-0d375b837c68","html_url":"https://github.com/rhildred/cors-proxy2","commit_stats":null,"previous_names":["rhildred/cors-proxy2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rhildred/cors-proxy2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Fcors-proxy2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Fcors-proxy2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Fcors-proxy2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Fcors-proxy2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhildred","download_url":"https://codeload.github.com/rhildred/cors-proxy2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Fcors-proxy2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32392300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"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":["cloudflare-pages","cors","functions","github","http-proxy","isomorphic-git","proxy","stackblitz"],"created_at":"2024-12-26T11:13:05.943Z","updated_at":"2026-04-28T17:35:36.591Z","avatar_url":"https://github.com/rhildred.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cors-proxy2\n[Cloudflare worker ](https://developers.cloudflare.com/pages/platform/functions/) to run with [Stackblitz.com](https://stackblitz.com) and [github.com](https://github.com).\n\nTo use:\n\n`npm install --save-dev @rhildred/cors-proxy2`\n\nput the url in the path. For instance:\n\n```javascript\nconst res = await request(app).get(\"/corsproxy/github.com/diy-pwa/diy-pwa/archive/refs/heads/main.zip\");\n```\n\nConsume in cloudflare pages function. For instance in `functions/corsproxy/[[corsproxy]].js`:\n\n```javascript\nimport { CorsProxyResponse } from '@rhildred/cors-proxy2';\n\nexport async function onRequest(context){\n    context.env.url = context.request.url.replace(/^.*corsproxy/, \"https:/\");\n    return CorsProxyResponse.fetch(context.request, context.env);\n}\n\n```\n\nor as a worker I think. You will need to use a bundler.\n\n```javascript\nimport { CorsProxyResponse } from '@rhildred/cors-proxy2';\nexport default { \n    fetch(req, env){\n        env.url = req.url.replace(/^.*corsproxy/, \"https:/\");\n        return CorsProxyResponse.fetch(req, env);\n    }\n};\n```\n\nThis code is based on the [cors-proxy](https://github.com/isomorphic-git/cors-proxy) code from isomorphic-git. It is refactored to be exposed as a cloudflare worker or pages function.\n\nI am super excited about the tests for this cloudflare pages function/worker. Particularly this one:\n\n```\nimport { describe, it, expect } from 'vitest';\nimport request from 'supertest';\nimport createApp from './expressFixture.js';\nimport git from 'isomorphic-git';\nimport fs from 'fs';\nimport http from 'isomorphic-git/http/web';\n\n\n...\n\n    it(\"clones a git repo\", async ()=\u003e{\n        const app = createApp();\n        const server = await app.listen(8080);\n        await git.clone({\n            corsProxy: 'http://127.0.0.1:8080/corsproxy',\n            url: 'https://github.com/rhildred/cors-proxy2',\n            ref: 'main',\n            singleBranch: true,\n            depth: 10,\n            dir: 'test2',\n            fs: fs,\n            http\n        });  \n        await server.close();\n        expect(true).toBe(true);\n\n    }, 20000);\n\n```\nIt is exciting to me for 2 reasons. It is self contained. It consumes the actual proxy using the main use case. To use with isomorphic git.\n\nI am consuming the cloudflare pages function in [diy-pwa](https://github.com/diy-pwa/diy-pwa) and [git-pwa](https://github.com/diy-pwa/git-pwa). These projects are for a [stackblitz](https://stackblitz.com) development environment for sales engineers to make progressive web apps. The pwa is for hosting .svg configuration models and complements for business to business products.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Fcors-proxy2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhildred%2Fcors-proxy2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Fcors-proxy2/lists"}