Next.js Discord

Discord Forum
\n I am not familar with next js (only svelte) so sorry if it's a basic question. I was not able to find any working solution. I even added the following in next js config file headers: async () => {\n return [\n {\n // mathching all API routes\n source: \"/api/:path*\",\n headers: [\n { key: \"Access-Control-Allow-Credentials\", value: \"true\" },\n { key: \"Access-Control-Allow-Origin\", value: \"*\" },\n {\n key: \"Access-Control-Allow-Methods\",\n value: \"GET,OPTIONS,PATCH,DELETE,POST,PUT\",\n },\n {\n key: \"Access-Control-Allow-Headers\",\n value: \"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version\",\n },\n ],\n },\n ];\n },","dateCreated":"2024-09-16T12:24:16.698Z","answerCount":1,"author":{"@type":"Person","name":"Cuban Crocodile"},"suggestedAnswer":{"@type":"Answer","text":"Bump","url":"https://nextjs-forum.com/post/1285214675184783421#message-1285636102333399191","dateCreated":"2024-09-17T16:18:52.760Z","author":{"@type":"Person","name":"Cuban Crocodile"}}}}

cors issue with next js & fumadocs (CORS Allow Origin Not Matching Origin)

Unanswered
Cuban Crocodile posted this in #help-forum
Open in Discord
Avatar
Cuban CrocodileOP
Hello! I am facing issue when embedding self hosted umami in fumadocs layout file (in body tag)

            <body>
                <RootProvider>{children}</RootProvider>

                <script
                    defer
                    src="https://domain.something.tld/script.js"
                    data-website-id="id"
                ></script>
            </body>


I am not familar with next js (only svelte) so sorry if it's a basic question. I was not able to find any working solution. I even added the following in next js config file

    headers: async () => {
        return [
            {
                // mathching all API routes
                source: "/api/:path*",
                headers: [
                    { key: "Access-Control-Allow-Credentials", value: "true" },
                    { key: "Access-Control-Allow-Origin", value: "*" },
                    {
                        key: "Access-Control-Allow-Methods",
                        value: "GET,OPTIONS,PATCH,DELETE,POST,PUT",
                    },
                    {
                        key: "Access-Control-Allow-Headers",
                        value: "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
                    },
                ],
            },
        ];
    },
Image

1 Reply

Avatar
Cuban CrocodileOP
Bump