{"id":20475341,"url":"https://github.com/noobnooc/cf-redirect","last_synced_at":"2025-04-13T12:29:30.665Z","repository":{"id":252175418,"uuid":"839640472","full_name":"noobnooc/cf-redirect","owner":"noobnooc","description":"Url redirect service with Cloudflare Pages and KV","archived":false,"fork":false,"pushed_at":"2024-08-08T03:59:02.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T17:04:32.984Z","etag":null,"topics":["cloudflare","cloudflare-kv","cloudflare-pages","redirect","url-redirect","url-shortener"],"latest_commit_sha":null,"homepage":"","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/noobnooc.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":"2024-08-08T03:15:14.000Z","updated_at":"2025-02-11T06:39:45.000Z","dependencies_parsed_at":"2024-08-08T05:33:46.815Z","dependency_job_id":null,"html_url":"https://github.com/noobnooc/cf-redirect","commit_stats":null,"previous_names":["noobnooc/cf-redirect"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noobnooc%2Fcf-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noobnooc%2Fcf-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noobnooc%2Fcf-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noobnooc%2Fcf-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noobnooc","download_url":"https://codeload.github.com/noobnooc/cf-redirect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248713898,"owners_count":21149799,"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":["cloudflare","cloudflare-kv","cloudflare-pages","redirect","url-redirect","url-shortener"],"created_at":"2024-11-15T15:15:44.902Z","updated_at":"2025-04-13T12:29:30.643Z","avatar_url":"https://github.com/noobnooc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Pages Redirect Service\n\nThis project is a simple redirect service implemented using Cloudflare Pages and Cloudflare KV.\n\n[中文版](README.zh.md)\n\n## Deployment Steps\n\n1. Fork this repository to your GitHub account.\n\n2. In your Cloudflare Dashboard:\n   a. Create a new KV namespace.\n   b. Add your redirect rules to this KV namespace, for example:\n\n   - Key: `redirect:twitter`, Value: `https://twitter.com/your-handle`\n   - Key: `redirect:github`, Value: `https://github.com/your-username`\n   - Key: `redirect:*`, Value: `https://your-site.com`\n\n3. Create a new Pages project in your Cloudflare Dashboard:\n   a. Select your forked repository.\n   b. In the build settings:\n\n   - Set the build command to: (leave this empty)\n   - Set the build output directory to: `/`\n\n4. In the Pages project settings, go to \"Functions\" \u003e \"KV namespace bindings\":\n   a. Add a new binding:\n\n   - Variable name: `REDIRECT_KV`\n   - KV namespace: Select the KV namespace you created in step 2\n\n5. Redeploy the project to apply the settings.\n\nNow, when you visit `your-project.pages.dev/twitter`, it will redirect to the Twitter URL you set in the KV.\n\n## Customization\n\nYou can add or modify redirect rules by editing the key-value pairs in the KV namespace through the Cloudflare Dashboard, without changing any code.\n\n## How It Works\n\n- The `_middleware.js` file in the `functions` directory handles incoming requests.\n- It checks the KV namespace for a matching redirect rule based on the requested path.\n- If a matching rule is found, it redirects the user to the specified URL.\n- If no matching rule is found, it serves the default `index.html` page.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Note\n\nEnsure you don't include any sensitive information or private keys in your public repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoobnooc%2Fcf-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoobnooc%2Fcf-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoobnooc%2Fcf-redirect/lists"}