{"id":15715765,"url":"https://github.com/highcanfly-club/nocors","last_synced_at":"2025-05-12T23:53:42.110Z","repository":{"id":63190550,"uuid":"564830573","full_name":"highcanfly-club/nocors","owner":"highcanfly-club","description":"noCors proxy for Servless static apps","archived":false,"fork":false,"pushed_at":"2022-11-27T13:37:57.000Z","size":369,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"package","last_synced_at":"2025-05-12T23:53:36.398Z","etag":null,"topics":["azure-functions","azure-static-web-apps","cf-pages","cloudflare","cors","cors-proxy"],"latest_commit_sha":null,"homepage":"https://nocors.kiik.cf","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/highcanfly-club.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}},"created_at":"2022-11-11T15:47:08.000Z","updated_at":"2024-10-03T11:38:33.000Z","dependencies_parsed_at":"2023-01-23T00:15:30.462Z","dependency_job_id":null,"html_url":"https://github.com/highcanfly-club/nocors","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fnocors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fnocors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fnocors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/highcanfly-club%2Fnocors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/highcanfly-club","download_url":"https://codeload.github.com/highcanfly-club/nocors/tar.gz/refs/heads/package","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843185,"owners_count":21972870,"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":["azure-functions","azure-static-web-apps","cf-pages","cloudflare","cors","cors-proxy"],"created_at":"2024-10-03T21:42:48.817Z","updated_at":"2025-05-12T23:53:42.089Z","avatar_url":"https://github.com/highcanfly-club.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simplest noCors proxy for Serverless(Azure/Cloudflare) Web App\n\nThis is a very minimalistic proxy for enabling CORS on non CORS enabled sites.  \n\n## For Azure Static Web Apps  \n# npm package\nhttps://www.npmjs.com/package/@sctg/nocors-pages  \nYou must use it in the /api/package.json file, there is no need to modify the main package.json  \n\n# demo\n[Source code](https://github.com/highcanfly-club/nocors/tree/main).   \nhttps://nocors.kiik.cf/api/proxy?url=https://www.example.org\n# usage\nCreate a new api entry with VSCode Azure tools or manually.  \n```sh\ncd api\nnpm i --save @sctg/nocors-azure\nnpm i --save got\nnpm i --save @azure/functions\n```\nIn the index.ts of the new api route\n```ts\nimport {\n  AzureFunction,\n  Context,\n  HttpRequest,\n} from \"@azure/functions\";\nimport { proxyAzureRequest } from \"@sctg/nocors-azure\";\nconst WHITELIST_REGEX=\".*\" // DANGEROUS TAKE CARE OF THE WHITELIST\n\nconst httpTrigger: AzureFunction = async function (\n  context: Context,\n  req: HttpRequest\n): Promise\u003cvoid\u003e {\n  const proxiedRequest = await proxyAzureRequest(WHITELIST_REGEX, req);\n  context.res = {\n    status: proxiedRequest.status,\n    body: proxiedRequest.body,\n    headers: proxiedRequest.headers,\n  };\n};\n\nexport default httpTrigger;\n```\nNow you can proxy your API requests to non CORS enabled site via:  \nhttps://YOURSITE.TLD/api/proxy?url=https://NOCORS.WEBSITE/…/API/…/ . \nBe extremely attentive to the WHITELIST_REGEX const as it can opens your proxy to anyone  \nPrefer something like\n```js\nconst WHITELIST_REGEX=\"https://NOCORS.WEBSITE/.*\"\n```\n\n## For Coudflare Pages \n# npm package\nhttps://www.npmjs.com/package/@sctg/nocors-pages   \n\n# demo\n[Source code](https://github.com/highcanfly-club/nocors-cf).   \nhttps://nocors.pages.dev/proxy?url=https://www.example.org  \ncheck the header Via:noCors-for-serverless v…\n\n# usage\n```sh\nnpm i --save @sctg/nocors-pages\nnpm i -D --save @cloudflare/workers-types\n```\ncreate a /functions/proxy.ts file\n```ts\nimport {proxyPagesRequest} from \"@sctg/nocors-pages\"\nconst WHITELIST_REGEX=\".*\"  // DANGEROUS TAKE CARE OF THE WHITELIST\nexport const onRequest: PagesFunction = async (context) =\u003e {\n  return proxyPagesRequest(context,whitelistConf.regex)\n};\n```\nNow you can proxy your API requests to non CORS enabled site via:  \nhttps://YOURSITE.TLD/proxy?url=https://NOCORS.WEBSITE/…/API/…/  \nBe extremely attentive to the WHITELIST_REGEX const as it can opens your proxy to anyone  \nPrefer something like\n```js\nconst WHITELIST_REGEX=\"https://NOCORS.WEBSITE/.*\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhighcanfly-club%2Fnocors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhighcanfly-club%2Fnocors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhighcanfly-club%2Fnocors/lists"}