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.

Fix css on production You don't have access to this project (#1194)

Ivan Starkovdb3b42ae7d9e
diff --git a/apps/builder/app/shared/context.server.ts b/apps/builder/app/shared/context.server.ts
index 221acb33ec..49180ae7fe 100644
--- a/apps/builder/app/shared/context.server.ts
+++ b/apps/builder/app/shared/context.server.ts
@@ -15,7 +15,16 @@ const createAuthorizationContext = async (
request: Request,
buildEnv: AppContext["authorization"]["buildEnv"]
): Promise<AppContext["authorization"]> => {
- const url = new URL(request.url);
+ const originUrl = new URL(request.url);
+ let url = originUrl;
+
+ // In case of css use referrer as url to extract tokens from canvas iframe href
+ if (originUrl.pathname === "/s/css") {
+ const referer = request.headers.get("referer");
+ if (referer !== null) {
+ url = new URL(referer);
+ }
+ }
const authReadTokenRaw = url.searchParams.get("authReadToken") ?? undefined;
const authToken = url.searchParams.get("authToken") ?? url.hostname;