geelen
01/26/2022, 4:26 PMmarahmanjs
01/26/2022, 6:30 PMWallacy
01/26/2022, 11:50 PMWallacy
01/26/2022, 11:52 PMzsmooth
01/27/2022, 12:10 AMEpailes
01/27/2022, 10:20 AMEpailes
01/27/2022, 10:22 AMsteranevdy
01/27/2022, 11:33 AMCоlе
01/30/2022, 2:00 AMCоlе
01/30/2022, 2:02 AMts
import { Regexes } from '@vl-types/regexes';
export const onRequestGet: PagesFunction<{}> = async ({ request, env, next, data, params }) => {
if (Regexes.username.test(params.id as string)) {
// Redirect to main page
const cloned = request.clone();
const dest = `${(env as any).BASE_URL}`;
return env.ASSETS.fetch(new Request(dest, { headers: cloned.headers }));
}
return next();
};
On wrangler, it works fine. On pages, it throws 406Cоlе
01/30/2022, 2:03 AMAccept-*
headers, so I made sure to throw in the headers from the original requestbsam75
01/31/2022, 3:29 PMJames
01/31/2022, 3:38 PMbsam75
01/31/2022, 3:39 PMzsmooth
01/31/2022, 8:13 PMpencilflip
01/31/2022, 11:40 PM/foo
, then the header tags look like <meta name="description" content="foo"/>
, and when you go to /bar
, the header tags look like <meta name="description" content="bar"/>
pencilflip
01/31/2022, 11:41 PMpencilflip
01/31/2022, 11:41 PMzsmooth
01/31/2022, 11:56 PMzsmooth
01/31/2022, 11:59 PMpencilflip
02/01/2022, 12:16 AMpencilflip
02/01/2022, 12:16 AMpencilflip
02/01/2022, 12:16 AMzsmooth
02/01/2022, 12:16 AMzsmooth
02/01/2022, 12:17 AMpencilflip
02/01/2022, 12:18 AMzsmooth
02/01/2022, 12:19 AMpencilflip
02/01/2022, 12:22 AMbuild/index.html
and my functions code is in functions/foo.ts
, how would I return the static html?zsmooth
02/01/2022, 12:25 AMpencilflip
02/01/2022, 12:26 AM