From 693c363f7302228e2305ccb4fdfaf7227e748614 Mon Sep 17 00:00:00 2001 From: taskylizard <75871323+taskylizard@users.noreply.github.com> Date: Sat, 4 Nov 2023 23:05:37 +0530 Subject: [PATCH] cors trial 5 --- .vitepress/theme/components/Feedback.vue | 2 +- nitro.config.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.vitepress/theme/components/Feedback.vue b/.vitepress/theme/components/Feedback.vue index df6116866..03cdfd85a 100644 --- a/.vitepress/theme/components/Feedback.vue +++ b/.vitepress/theme/components/Feedback.vue @@ -47,7 +47,7 @@ async function handleSubmit(type?: string) { method: "POST", headers: { "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "POST,PATCH,OPTIONS", + "Access-Control-Allow-Methods": "POST", "Content-Type": "application/json", }, body: JSON.stringify(body), diff --git a/nitro.config.ts b/nitro.config.ts index 13990ecaa..e9142d01f 100644 --- a/nitro.config.ts +++ b/nitro.config.ts @@ -5,6 +5,12 @@ export default defineNitroConfig({ }, srcDir: ".vitepress", routeRules: { - "/": { cors: false }, + "/": { + cors: true, + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "POST", + }, + }, }, });