GET() — astro Function Reference
Architecture documentation for the GET() function in image-endpoint.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD a7be050e_44ab_be9a_e8ce_076a7fd06da6["GET()"] 8b4ba749_e2c7_52bd_0100_37c345e7790d["image-endpoint.ts"] a7be050e_44ab_be9a_e8ce_076a7fd06da6 -->|defined in| 8b4ba749_e2c7_52bd_0100_37c345e7790d style a7be050e_44ab_be9a_e8ce_076a7fd06da6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts lines 8–33
export const GET: APIRoute = (ctx) => {
const href = ctx.url.searchParams.get('href');
if (!href) {
return new Response("Missing 'href' query parameter", {
status: 400,
statusText: "Missing 'href' query parameter",
});
}
if (isRemotePath(href)) {
if (isRemoteAllowed(href, imageConfig) === false) {
return new Response('Forbidden', { status: 403 });
} else {
// Redirect here because it is safer than a proxy, remote image will be served by remote domain and not own domain
return Response.redirect(href, 302);
}
}
const proxied = new URL(href, ctx.url.origin);
// Have we been tricked into thinking this is local?
if (proxied.origin !== ctx.url.origin) {
return new Response('Forbidden', { status: 403 });
}
return fetch(proxied);
};
Domain
Subdomains
Source
Frequently Asked Questions
What does GET() do?
GET() is a function in the astro codebase, defined in packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts.
Where is GET() defined?
GET() is defined in packages/integrations/cloudflare/src/entrypoints/image-endpoint.ts at line 8.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free