Cloudflare PagesにBasic認証かけるやつ、Honoの次のマイナーアップデート「v3.1.0」で簡単にできる予定。 import { Hono } from 'hono' import { basicAuth } from 'hono/basic-auth' import { EventContext, handle } from 'hono/cloudflare-pages' type Bindings = { eventContext: EventContext } const app = new Hono<{ Bindings: Bindings }>() app.all( '*', basicAuth({ username: 'foo', password: 'bar', }), async (c) => { return c.env.eventContext.ne
![Cloudflare PagesにBasic認証かけるやつ](https://cdn-ak-scissors.b.st-hatena.com/image/square/53d1a78fb8760746cf07c3f90182f0ef83ca4018/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--1Tn2KJSE--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3ACloudflare%252520Pages%2525E3%252581%2525ABBasic%2525E8%2525AA%25258D%2525E8%2525A8%2525BC%2525E3%252581%25258B%2525E3%252581%252591%2525E3%252582%25258B%2525E3%252582%252584%2525E3%252581%2525A4%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Ayusukebe%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EtL0FPaDE0R2pIMWY1VlpnSFMwLUJwekhzZjRGYXN0R1ZYTlpfZFh1U2pwdWNMNGc9czI1MC1j%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)