feat: migrate CozSweet legal documents
This commit is contained in:
@@ -19,6 +19,13 @@ interface ExecutionContext {
|
||||
passThroughOnException(): void;
|
||||
}
|
||||
|
||||
const LEGAL_DOCUMENT_REDIRECTS: Record<string, string> = {
|
||||
"/cozsweet/privacy-policy.html": "/privacy-policy.html",
|
||||
"/cozsweet/data-deletion.html": "/data-deletion.html",
|
||||
"/cozsweet/membership-agreement.html": "/membership-agreement.html",
|
||||
"/cozsweet/auto-renewal-agreement.html": "/auto-renewal-agreement.html",
|
||||
};
|
||||
|
||||
// Image security config. SVG sources with .svg extension auto-skip the
|
||||
// optimization endpoint on the client side (served directly, no proxy).
|
||||
// To route SVGs through the optimizer (with security headers), set
|
||||
@@ -29,6 +36,11 @@ const worker = {
|
||||
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
const url = new URL(request.url);
|
||||
|
||||
const legalDocumentPath = LEGAL_DOCUMENT_REDIRECTS[url.pathname];
|
||||
if (legalDocumentPath) {
|
||||
return Response.redirect(new URL(legalDocumentPath, request.url), 308);
|
||||
}
|
||||
|
||||
if (url.pathname === "/_vinext/image") {
|
||||
const allowedWidths = [...DEFAULT_DEVICE_SIZES, ...DEFAULT_IMAGE_SIZES];
|
||||
return handleImageOptimization(request, {
|
||||
|
||||
Reference in New Issue
Block a user