I wanted to try out v0 for an astro project but couldnt get the preview to work. The only message shown is Cross-origin request blocked. I tried serveral settings in the astro config (see below) to disable CORS and make it work but its still not possible to view the page in the browser.
Funnily, I am able to see the page preview in the mobile app.
Any help or pointer are much appreciated!
My astro config:
// @ts-checkimport { defineConfig } from "astro/config"import tailwindcss from "@tailwindcss/vite"
// https://astro.build/configexport default defineConfig({ site: "https://friva.at", i18n: { defaultLocale: "en", locales: ["en", "de"], routing: { prefixDefaultLocale: false, redirectToDefaultLocale: false, }, }, security: { checkOrigin: false, csp: false, // The v0 preview embeds the dev server in a cross-origin iframe, so the // proxy requests the page with `Sec-Fetch-Mode: cors` / // `Sec-Fetch-Site: cross-site`. Astro's dev router blocks those with a // 403 "Cross-origin request blocked" unless the request's Origin matches // an entry here. An entry with no `hostname` matches every origin, which // is safe because this dev-only check is not present in production builds. allowedDomains: [{ hostname: "v0.app" }, {}], }, server: { host: true, }, vite: { plugins: [tailwindcss()], server: { // Allow any Host header (Vite's separate host-validation gate) so the // proxied preview hostname is accepted, and reflect CORS for assets. allowedHosts: true, cors: true, hmr: { clientPort: 443 }, }, },})
