[READ-ONLY] Mirror of https://github.com/improsocial/impro An extensible Bluesky client for web impro.social
6

Configure Feed

Select the types of activity you want to include in your feed.

Send 404 for missing assets in cloudflare pages

Grace Kind (Jul 11, 2026, 1:15 PM -0500) acc1892b 976cf23b

+25
+1
eleventy.config.js
··· 23 23 eleventyConfig.addPassthroughCopy("src/img"); 24 24 eleventyConfig.addPassthroughCopy("src/manifest.json"); 25 25 eleventyConfig.addPassthroughCopy("src/_headers"); 26 + eleventyConfig.addPassthroughCopy("src/_routes.json"); 26 27 eleventyConfig.addPassthroughCopy("src/plugin-sandbox.html"); 27 28 28 29 // Prevent sandbox from being treated as a template
+19
functions/_middleware.js
··· 1 + // Send 404s for missing assets in Cloudflare pages 2 + 3 + const ASSET_EXTENSIONS = 4 + /\.(m?js|css|json|md|svg|png|jpe?g|gif|webp|ico|woff2?)$/; 5 + 6 + export async function onRequest(context) { 7 + const response = await context.next(); 8 + const { pathname } = new URL(context.request.url); 9 + const isHtml = (response.headers.get("Content-Type") || "").includes( 10 + "text/html", 11 + ); 12 + if (ASSET_EXTENSIONS.test(pathname) && isHtml) { 13 + return new Response(`Not found: ${pathname}`, { 14 + status: 404, 15 + headers: { "Content-Type": "text/plain; charset=utf-8" }, 16 + }); 17 + } 18 + return response; 19 + }
+5
src/_routes.json
··· 1 + { 2 + "version": 1, 3 + "include": ["/js/*", "/css/*", "/img/*"], 4 + "exclude": [] 5 + }