{"id":13734791,"url":"https://github.com/lebinh/cloudflare-workers","last_synced_at":"2025-04-23T08:07:08.091Z","repository":{"id":44404565,"uuid":"120405616","full_name":"lebinh/cloudflare-workers","owner":"lebinh","description":"My collection of Cloudflare Workers scripts: https://developers.cloudflare.com/workers/","archived":false,"fork":false,"pushed_at":"2018-07-27T01:39:28.000Z","size":22,"stargazers_count":88,"open_issues_count":1,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-23T08:07:02.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/lebinh.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":"2018-02-06T05:20:33.000Z","updated_at":"2025-01-17T15:14:04.000Z","dependencies_parsed_at":"2022-07-15T07:00:30.527Z","dependency_job_id":null,"html_url":"https://github.com/lebinh/cloudflare-workers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebinh%2Fcloudflare-workers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebinh%2Fcloudflare-workers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebinh%2Fcloudflare-workers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebinh%2Fcloudflare-workers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lebinh","download_url":"https://codeload.github.com/lebinh/cloudflare-workers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395283,"owners_count":21423400,"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":[],"created_at":"2024-08-03T03:00:59.902Z","updated_at":"2025-04-23T08:07:08.070Z","avatar_url":"https://github.com/lebinh.png","language":"TypeScript","readme":"## Cloudflare Workers\n\n[Cloudflare Workers](https://developers.cloudflare.com/workers/about/) scripts are Javascript programs\nthat can be run on Cloudflare's edge server, all [120 of them](https://www.cloudflare.com/network/).\nThey are modeled based on [Service Workers API](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API)\nand is currently in open beta.\n\n## Workers Zoo\n\nThis repo is just a collection of my workers when playing with it Cloudflare Workers:\n\n* [http_prober](src/http_prober.ts) - An implementation of Prometheus's blackbox-exporter HTTP probe.\n\n    ```\n    $ curl 'thisisbinh.me/worker/http_prober?module=http_get_2xx\u0026target=http://example.com/'\n    probe_success 0\n    probe_duration_seconds 0.694\n    probe_http_status_code 200\n    probe_http_redirected 1\n    probe_http_content_length -1\n    ```\n\nThis potentially can be used to monitor availability / performance of your origin server from Cloudflare point of view.  \n\n* [proxy](src/proxy.ts) - Using worker as a HTTP proxy for other websites, e.g. https://thisisbinh.me/worker/proxy/github.com/lebinh\n\n* [echo](src/echo.ts) - Debugging / testing script that just echo back the request/response from worker point of view.\n\n    ```\n    $ curl thisisbinh.me/worker/echo/request/headers\n    accept: */*\n    accept-encoding: gzip\n    cf-connecting-ip: 139.59.112.58\n    cf-force-miss-ts: 0\n    cf-ipcountry: IN\n    cf-ray: 3e94c829a18d17b0\n    cf-visitor: {\"scheme\":\"http\"}\n    connection: Keep-Alive\n    host: thisisbinh.me\n    user-agent: curl/7.52.1\n    x-forwarded-proto: http\n    x-real-ip: 139.59.112.58\n    ```\n\n## Playing with it\n\nYou will need TypeScript compiler to compile the sources. You can install it and other dependencies with\n```\nnpm install\n```\n\nTo build the Workers Javascript files from TypeScript sources:\n\n```\n$ make\n```\n\nTo run test:\n\n```\n$ make test\n```\n\nTo deploy **all** scripts to your Cloudflare account:\n\n```\n$ export CF_AUTH_EMAIL=your@email\n$ export CF_AUTH_KEY=your_cloudflare_api_key\n$ make deploy\n```\n","funding_links":[],"categories":["Tool"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebinh%2Fcloudflare-workers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebinh%2Fcloudflare-workers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebinh%2Fcloudflare-workers/lists"}