{"id":20617630,"url":"https://github.com/flaregun-net/proxyflare-for-pages","last_synced_at":"2025-08-02T04:33:24.176Z","repository":{"id":65346170,"uuid":"497199223","full_name":"flaregun-net/proxyflare-for-pages","owner":"flaregun-net","description":"🔥 A reverse proxy for your Cloudflare Pages domain","archived":false,"fork":false,"pushed_at":"2023-06-24T19:26:20.000Z","size":2292,"stargazers_count":76,"open_issues_count":5,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-29T06:25:52.130Z","etag":null,"topics":["cloudflare-pages","cloudflare-pages-functions","cloudflare-workers","nginx","reverse-proxy"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@flaregun-net/proxyflare-for-pages","language":"TypeScript","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/flaregun-net.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-05-28T03:12:35.000Z","updated_at":"2025-07-21T13:17:25.000Z","dependencies_parsed_at":"2025-01-06T12:31:56.945Z","dependency_job_id":"2a1a711e-2ff2-47cf-b729-4623eff22adf","html_url":"https://github.com/flaregun-net/proxyflare-for-pages","commit_stats":{"total_commits":22,"total_committers":4,"mean_commits":5.5,"dds":"0.18181818181818177","last_synced_commit":"0dcb8261d821c87552442238286c2ca4147400e8"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/flaregun-net/proxyflare-for-pages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaregun-net%2Fproxyflare-for-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaregun-net%2Fproxyflare-for-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaregun-net%2Fproxyflare-for-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaregun-net%2Fproxyflare-for-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flaregun-net","download_url":"https://codeload.github.com/flaregun-net/proxyflare-for-pages/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaregun-net%2Fproxyflare-for-pages/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334618,"owners_count":24233793,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","cloudflare-pages-functions","cloudflare-workers","nginx","reverse-proxy"],"created_at":"2024-11-16T12:05:05.437Z","updated_at":"2025-08-02T04:33:23.925Z","avatar_url":"https://github.com/flaregun-net.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proxyflare for Cloudflare Pages\n\n[Visit our website](https://flaregun.net/docs/latest/proxyflare/plugin/getting-started) for the full documentation.\n\n## Overview\n\nProxyflare is a reverse proxy that makes it easy to move HTTP traffic around your domain and across the internet.\n\nThis package provides Proxyflare as a [Cloudflare Pages](https://developers.cloudflare.com/pages) plugin. Any website deployed on Cloudflare Pages may use Proxyflare.\n\nProxyflare is a middleware layer that matches incoming requests to `Routes` in your `Configuration`.\n\nRefer to the Cloudflare documentation for more information about [Pages Middleware](https://developers.cloudflare.com/pages/platform/functions/middleware/), [Pages Functions](https://developers.cloudflare.com/pages/platform/functions) and other awesome community [Plugins](https://developers.cloudflare.com/pages/platform/functions/plugins/) that can enhance your website.\n\n## Use cases\n\n### Proxy traffic to another service\n\nProxy traffic from a part of your domain to another service on the same domain or elsewhere on the internet\n\n#### Examples\n\n1. Move traffic from `https://yoursite.com/api/*` to `https://your-hosted-api.com`\n1. Host a service on `https://torrents.yoursite.com/*` that points to `http://yoursite.com:41321`\n\n#### Notes\n\n- Proxyflare works over `http(s):` and `ws(s):` (websockets)\n- A proxied service must be available on the public internet\n- Both standard and custom ports are supported (e.g. `80`, `443`, `8787`, etc.)\n\n[Learn more](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/proxying-services)\n\n### Mount a hosted website on your domain\n\n#### Examples\n\n1. Mount your React-powered documentation hosted at `https://hosted-docs.com` on `https://yoursite.com/docs/*`\n1. Mount a WordPress site hosted at `https://some-wordpress-blog.com` on `https://yoursite.com/blog/*`\n\n#### Notes\n\n- Mounted websites should configure the base url to match its mounted pathname\n- Static resources such as stylesheets must be carefully added to `Route[\"to.website.resources\"]`\n\n[Learn more](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/proxying-websites)\n\n### Redirect traffic from one place to another\n\n1. Version an API (e.g. redirect `/v2/api`)\n1. Redirect stale content URLs\n\n#### Notes\n\n- Redirects are wildcard-compatible\n- Any 300-level status code is supported\n\n[Learn more](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/redirecting-traffic)\n\n### Serve static content through Proxyflare\n\n1. Publish unique `robots.txt` and other website metadata files around your domain\n\n#### Notes\n\n- Custom response headers are supported to set `Content-Type` for text, JSON, or others\n- Text files should be no larger than 16KB\n\n[Learn more](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/serving-static-responses)\n\n## Install\n\nInstall `@flaregun-net/proxyflare-for-pages` and `@cloudflare/workers-types` using your preferred Node.js package manager\n\n```bash\nnpm install @flaregun-net/proxyflare-for-pages\nnpm install -D @cloudflare/workers-types\n```\n\n## Plug in\n\n### Scaffold\n\nIn your Cloudflare Pages project, create a `functions/_middleware.ts` file. The name of this file must be exactly as written because Cloudflare Pages uses the file name internally for routing. If your project already has a `functions/_middleware.ts` that exports a single `onRequest` object, convert it to a list of middleware for convenience. Middleware is called in the order listed.\n\nThe `onRequest` middlewares should include the following configuration. Notice that we wrap Proxyflare in a `PagesFunction` in order to use environment variables with Proxyflare. [Learn more](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/using-environment-variables/) about environment variables and secrets.\n\n```ts\nimport proxyflare from \"@flaregun-net/proxyflare-for-pages\"\n\nconst routes: Route[] = []\n\n// `PagesFunction` is from @cloudflare/workers-types\nexport const onRequest: PagesFunction[] = [\n  (context) =\u003e\n    proxyflare({\n      config: {\n        global: { debug: true },\n        routes,\n      },\n    })(context),\n  // other Pages plugins and middleware\n]\n```\n\nThis is a barebones Proxyflare configuration with `debug` enabled that will help with set up and configuration. Learn more about [debugging Proxyflare](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/debugging-proxyflare/).\n\n### Configure\n\nNext, you'll need to write your first `Route`. Check out the [use cases](#use-cases) section to find `Route` ideas. If you don't have one yet, try this example:\n\n```ts\nconst routes: Route[] = [\n  {\n    from: {\n      pattern: \"yourdomain.com/proxyflare-example\",\n      alsoMatchWWWSubdomain: true,\n    },\n    to: { url: \"https://example.com\" },\n  },\n]\n```\n\nReplace `yoursite.com` with your domain name.\n\n### Deploy\n\nOnce you have a `Route` set up, deploy a new version of your Cloudflare Pages website, and keep an eye on the deployment. Once the deployment is successful, navigate to your domain.\n\nFor the example `Route` above, you should see `https://example.com` rendered at `yourdomain.com/proxyflare-example`. If you don't see it, refer to the [debugging Proxyflare](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/debugging-proxyflare/) section or reach out for help in Discord.\n\n## Next steps\n\nNow that you're up and running, check out the [Tutorials](https://flaregun.net/docs/latest/proxyflare/plugin/tutorials/proxying-services/) to learn more about what you can do with Proxyflare.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaregun-net%2Fproxyflare-for-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaregun-net%2Fproxyflare-for-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaregun-net%2Fproxyflare-for-pages/lists"}