Isaac McFadyen | YYZ01
03/17/2022, 2:12 PMIsaac McFadyen | YYZ01
03/17/2022, 2:12 PMIsaac McFadyen | YYZ01
03/17/2022, 2:12 PMthe-philociraptor
03/17/2022, 2:15 PM/api
to go to another domain I own where the api is hosted; but still have the result appear to be coming from /api
for cookies and such to work properlythe-philociraptor
03/17/2022, 2:16 PMIsaac McFadyen | YYZ01
03/17/2022, 2:16 PMIsaac McFadyen | YYZ01
03/17/2022, 2:16 PMthe-philociraptor
03/17/2022, 2:19 PMIsaac McFadyen | YYZ01
03/17/2022, 2:19 PMconst clonedRequest = new Request(request.body, request)
instead of just clone()
- Change the URL of the request.
- Run a fetch
with the Request as input.
- Return the results of the fetch.
That way everything about the request stays the same, except you change the URL.the-philociraptor
03/17/2022, 2:21 PMthe-philociraptor
03/17/2022, 2:21 PMthe-philociraptor
03/17/2022, 2:23 PMIsaac McFadyen | YYZ01
03/17/2022, 2:23 PMIsaac McFadyen | YYZ01
03/17/2022, 2:24 PMIsaac McFadyen | YYZ01
03/17/2022, 2:24 PMIsaac McFadyen | YYZ01
03/17/2022, 2:24 PMIsaac McFadyen | YYZ01
03/17/2022, 2:24 PMthe-philociraptor
03/17/2022, 2:25 PMthe-philociraptor
03/17/2022, 2:26 PMIsaac McFadyen | YYZ01
03/17/2022, 2:27 PMIsaac McFadyen | YYZ01
03/17/2022, 2:27 PMthe-philociraptor
03/17/2022, 2:29 PMIsaac McFadyen | YYZ01
03/17/2022, 2:31 PMIsaac McFadyen | YYZ01
03/17/2022, 2:31 PMthe-philociraptor
03/17/2022, 2:34 PMthe-philociraptor
03/17/2022, 2:35 PMRui Saraiva
03/17/2022, 5:07 PM/start/**
) when deployed to Cloudflare Pages.
One thing that I'm seeing is that I'm getting a lot more functions requests than I expected being reported on the Cloudflare Pages dashboard top right corner.
Example: https://d.pr/i/kRaiso currently 5k functions requests and I barely open any off those client-only URLs today since these routes are available only on preview deployments.
This is what my function functions/start/[[path]].ts
file looks like:
ts
export const onRequestGet: PagesFunction = async ({ env, request }) => {
return env.ASSETS.fetch(new Request(new URL('/start/', request.url).toString(), request));
};
Am I missing anything regarding functions on Cloudflare Pages?JuliusSeeser
03/17/2022, 5:13 PMWalshy | Pages
03/17/2022, 5:16 PM