Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

880 B
Raw Blame
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";
import { isProtectedResourceReentry } from "@webstudio-is/sdk/protected-resource-fetch";
// @ts-ignore - generated by the Webstudio CLI at build time
import { projectId } from "../app/__generated__/_index";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - the server build file is generated by `remix vite:build`
import * as build from "../build/server";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - the server build file is generated by `remix vite:build`
const requestHandler = createPagesFunctionHandler({ build });

export const onRequest: typeof requestHandler = async (context) => {
  if (isProtectedResourceReentry(context.request, projectId)) {
    return new Response(null, { status: 508 });
  }
  return requestHandler(context);
};