├── docs └── assets │ └── preview.png ├── wrangler.toml ├── package.json ├── tsconfig.json ├── .github └── workflows │ └── deploy.yml ├── .gitignore ├── README.md ├── src └── index.ts └── public ├── 404.html └── index.html /docs/assets/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajshovon/anyflare/HEAD/docs/assets/preview.png -------------------------------------------------------------------------------- /wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "anyflare" 2 | main = "src/index.ts" 3 | compatibility_date = "2024-11-25" 4 | 5 | [assets] 6 | directory = "./public" 7 | binding = "ANYFLARE_ASSETS" 8 | html_handling = "force-trailing-slash" 9 | not_found_handling = "404-page" 10 | 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anyflare", 3 | "scripts": { 4 | "dev": "wrangler dev", 5 | "deploy": "wrangler deploy --minify" 6 | }, 7 | "devDependencies": { 8 | "@cloudflare/workers-types": "^4.20250606.0", 9 | "wrangler": "^4.19.1" 10 | } 11 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "lib": [ 9 | "ESNext" 10 | ], 11 | "types": [ 12 | "@cloudflare/workers-types/2023-07-01" 13 | ], 14 | "jsx": "react-jsx", 15 | "jsxImportSource": "hono/jsx" 16 | }, 17 | } -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Worker 2 | on: 3 | push: 4 | pull_request: 5 | repository_dispatch: 6 | workflow_dispatch: 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-latest 10 | timeout-minutes: 60 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Build & Deploy Worker 14 | uses: cloudflare/wrangler-action@v3 15 | with: 16 | apiToken: ${{ secrets.CF_API_TOKEN }} 17 | accountId: ${{ secrets.CF_ACCOUNT_ID }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | 4 | # dev 5 | .yarn/ 6 | !.yarn/releases 7 | .vscode/* 8 | !.vscode/launch.json 9 | !.vscode/*.code-snippets 10 | .idea/workspace.xml 11 | .idea/usage.statistics.xml 12 | .idea/shelf 13 | 14 | # deps 15 | node_modules/ 16 | .wrangler 17 | 18 | # env 19 | .env 20 | .env.production 21 | .dev.vars 22 | 23 | # logs 24 | logs/ 25 | *.log 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | pnpm-debug.log* 30 | lerna-debug.log* 31 | 32 | # misc 33 | .DS_Store 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Anyflare 2 | 3 | ## Introduction 4 | 5 | Anyflare is a cloudflare worker proxy which you can deploy yourself to download anything through cloudflare. 6 | 7 | ## Preview 8 | 9 | ![Anyflare Preview Image](docs/assets/preview.png "Anyflare") 10 | 11 | ## Features 12 | 13 | - **Increase Speed**: Increase your slow download speed with Cloudflare CDN 14 | - **Resumable Downloads**: Generates resumable download url for any url 15 | - **Universal**: Works with most if not any download links 16 | 17 | ## Deployment 18 | 19 | ### Easily deploy with Cloudflare Worker 20 | 21 | [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/ajshovon/anyflare) 22 | 23 | ### Manual Deploy 24 | 25 | ```bash 26 | # Clone this repo 27 | git clone https://github.com/ajshovon/anyflare 28 | 29 | # Goto the repo dir 30 | cd anyflare 31 | 32 | # Install dependency 33 | npm install 34 | 35 | # Deploy 36 | npm run deploy 37 | 38 | ``` 39 | 40 | ## Development 41 | 42 | ```bash 43 | 44 | # Start development server 45 | npm run dev 46 | 47 | ``` 48 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | async fetch(request: Request, env: { ANYFLARE_ASSETS: Fetcher }, ctx: ExecutionContext): Promise { 3 | const url = new URL(request.url); 4 | 5 | // Proxy logic 6 | if (url.pathname.startsWith("/proxy/")) { 7 | let targetPath = url.pathname.substring("/proxy/".length); 8 | targetPath = targetPath.replace(/^https?:\/\//, ''); 9 | const pathParts = targetPath.split('/'); 10 | 11 | if (pathParts.length < 1) { 12 | return new Response("Error: No URL provided.", { status: 400 }); 13 | } 14 | 15 | const domain = pathParts[0]; 16 | const restPath = pathParts.slice(1).join('/'); 17 | try { 18 | const targetUrl = new URL(`https://${domain}/${restPath}${url.search}`); 19 | const modifiedRequest = new Request(targetUrl.toString(), { 20 | method: request.method, 21 | headers: { 22 | ...Object.fromEntries(request.headers), 23 | Host: targetUrl.hostname, 24 | }, 25 | }); 26 | 27 | return fetch(modifiedRequest); 28 | } catch (error) { 29 | console.error("Error processing URL:", error); 30 | return new Response("Error: Invalid or improperly formatted URL.", { status: 400 }); 31 | } 32 | } 33 | 34 | const assetResponse = await env.ANYFLARE_ASSETS.fetch(request); 35 | return assetResponse; 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 404 – Not Found | Anyflare 7 | 8 | 128 | 129 | 130 |
131 |
132 |
133 | 139 | 146 |
147 |
148 |
149 |
150 |
151 |
152 |

404

153 |

the page you’re looking for doesn’t exist.
maybe it was moved or never existed.

154 | go home 155 |
156 |
157 |
158 | 163 | 185 | 186 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Anyflare - Download Accelerator 7 | 8 | 557 | 558 | 559 |
560 |
561 |
562 | 568 | 574 |
575 |
576 |
577 | 578 |
579 |
580 |
581 |

accelerate your downloads

582 |

self-deployed download accelerator powered by cloudflare workers

583 |
584 | 585 |
586 |
587 |
588 | 595 | 601 |
602 | 603 |
604 | 605 |
606 | unlimited downloads 607 | global cdn 608 | bypass restrictions 609 | self-hosted 610 |
611 |
612 | 613 |
614 |

frequently asked questions

615 | 616 |
617 |
what is anyflare?
618 |
619 | anyflare is a self-deployed download accelerator that runs on cloudflare workers. it acts as a proxy to speed up downloads, bypass regional restrictions, and provide a more reliable download experience through cloudflare's global edge network. 620 |
621 |
622 |
623 |
how does it work?
624 |
625 | when you enter a download url, anyflare creates a proxy link like your-domain.com/proxy/original-url. the cloudflare worker fetches the file from the original source and streams it to you through cloudflare's optimized network, potentially improving speed and reliability. It works on almost all hosts. 626 |
627 |
628 | 629 |
630 |
is it free to use?
631 |
632 | anyflare itself is open source and free. however, you need to deploy it on your own cloudflare workers account. cloudflare workers has a generous free tier (100,000 requests/day), but heavy usage may incur costs based on cloudflare's pricing. 633 |
634 |
635 | 636 |
637 |
what file types are supported?
638 |
639 | anyflare can proxy any file type - videos, archives, documents, software, etc. there are no restrictions on file types, only cloudflare workers' limits on request size and duration apply. 640 |
641 |
642 | 643 |
644 |
having issues or need help?
645 |
646 | for bugs, feature requests, or deployment help, please open an issue on github. 647 |
648 |
649 | 650 |
651 |
is my data safe?
652 |
653 | since you deploy anyflare on your own cloudflare account, you have full control over your instance. no data is stored permanently - files are streamed through the worker without being saved. always deploy from the official github repository. 654 |
655 |
656 |
657 | 658 |
659 |

deploy your own instance

660 |

get started with anyflare on cloudflare workers in under 2 minutes

661 | 679 |
680 |
681 |
682 | 683 | 688 | 689 |
690 | 691 | 815 | 816 | --------------------------------------------------------------------------------