{"id":16506749,"url":"https://github.com/garrison/cloudflare-pages-shared-password","last_synced_at":"2025-03-04T16:32:09.108Z","repository":{"id":39505159,"uuid":"498529220","full_name":"garrison/cloudflare-pages-shared-password","owner":"garrison","description":"Demonstration of a static site hosted on Cloudflare Pages with HTTP basic authentication","archived":false,"fork":false,"pushed_at":"2022-06-01T22:53:41.000Z","size":12,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T01:46:16.977Z","etag":null,"topics":["cloudflare-pages","cloudflare-pages-functions","static-site"],"latest_commit_sha":null,"homepage":"https://cloudflare-pages-shared-password.pages.dev/","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/garrison.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}},"created_at":"2022-05-31T23:34:56.000Z","updated_at":"2025-01-18T10:42:27.000Z","dependencies_parsed_at":"2022-07-06T02:00:59.769Z","dependency_job_id":null,"html_url":"https://github.com/garrison/cloudflare-pages-shared-password","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/garrison%2Fcloudflare-pages-shared-password","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrison%2Fcloudflare-pages-shared-password/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrison%2Fcloudflare-pages-shared-password/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garrison%2Fcloudflare-pages-shared-password/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garrison","download_url":"https://codeload.github.com/garrison/cloudflare-pages-shared-password/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241880514,"owners_count":20035986,"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-pages","cloudflare-pages-functions","static-site"],"created_at":"2024-10-11T15:21:42.301Z","updated_at":"2025-03-04T16:32:08.689Z","avatar_url":"https://github.com/garrison.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloudflare-pages-shared-password\n\nThis repository demonstrates a static site which is hosted on Cloudflare Pages and whose content is \"protected\" by a shared username/password with [HTTP basic access authentication](https://en.wikipedia.org/wiki/Basic_access_authentication).  The real magic is in [`functions/_middleware.ts`](https://github.com/garrison/cloudflare-pages-shared-password/blob/main/functions/_middleware.ts), which is based on the [Cloudflare Workers example for HTTP basic authentication](https://developers.cloudflare.com/workers/examples/basic-auth/), repurposed as a [middleware](https://developers.cloudflare.com/pages/platform/functions#exporting-middleware) to be used with the [Functions](https://developers.cloudflare.com/pages/platform/functions) feature of Cloudflare Pages.\n\nThis demonstration site is hosted at https://cloudflare-pages-shared-password.pages.dev/, with `admin` as both the username and password.\n\nThe static site in this repository is built using [Hugo](https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/), but the middleware can be used with any static site hosted on Cloudflare Pages.\n\n## [Non]-Security\n\nI make no guarantees about the security of this code.  In particular, a shared password, stored in a repository, should not be expected to provide a meaningful degree of security.\n\n## Acknowledgments\n\nSpecial thanks to [CherryJimbo](https://jross.me/) and [Isaac McFadyen](https://imcf.me/) for responding to my questions on the Cloudflare Discord instance.  Their suggestions were essential in getting the first version of this code to work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrison%2Fcloudflare-pages-shared-password","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarrison%2Fcloudflare-pages-shared-password","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarrison%2Fcloudflare-pages-shared-password/lists"}