<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CORS error when calling &#x2F;api&#x2F;v3&#x2F;users with Authorization header in local setup]]></title><description><![CDATA[<p dir="auto">Hi NodeBB team,</p>
<p dir="auto">I have NodeBB running locally on my machine:</p>
<p dir="auto">NodeBB version: v3.12.7</p>
<p dir="auto">Environment: Local development</p>
<p dir="auto">Frontend: React (Vite) running on <a href="http://localhost:5173" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost:5173</a></p>
<p dir="auto">Backend (NodeBB) running on <a href="http://localhost:4567" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost:4567</a></p>
<p dir="auto">I’m trying to create a user via the API:</p>
<pre><code>async function registerUser() {
  try {
    const res = await fetch(`${import.meta.env.VITE_API_URL}v3/users`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${import.meta.env.VITE_TOKEN}`
      },
      body: JSON.stringify(formData),
    });

    if (!res.ok) {
      throw new Error(`HTTP error! Status: ${res.status}`);
    }

    const data = await res.json();
    console.log("User registered successfully:", data);
  } catch (error) {
    console.error("Error registering user:", error);
  }
}
</code></pre>
<p dir="auto">Question:<br />
How can I correctly configure NodeBB in development so that it allows the Authorization header in API requests?<br />
Even after setting Access-Control-Allow-Headers in the ACP, the browser still fails at the preflight request.<br />
Do I need a plugin or middleware to handle CORS for API v3 routes?</p>
]]></description><link>https://bbs.spacc.eu.org/new/topic/ad769e60-2d2d-4620-afcf-d65bff79445b/cors-error-when-calling-api-v3-users-with-authorization-header-in-local-setup</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 17:29:27 GMT</lastBuildDate><atom:link href="https://bbs.spacc.eu.org/new/topic/ad769e60-2d2d-4620-afcf-d65bff79445b.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Aug 2025 11:22:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CORS error when calling &#x2F;api&#x2F;v3&#x2F;users with Authorization header in local setup on Tue, 12 Aug 2025 15:33:24 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://community.nodebb.org/user/balu" target="_blank" rel="noopener noreferrer nofollow ugc">balu</a> can you confirm that the response you receive in the Vite app indeed contains the restrictive ACAO headers irrespective of what is set in the ACP?</p>
]]></description><link>https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/105505</link><guid isPermaLink="true">https://bbs.spacc.eu.org/new/post/https://community.nodebb.org/post/105505</guid><dc:creator><![CDATA[julian@community.nodebb.org]]></dc:creator><pubDate>Tue, 12 Aug 2025 15:33:24 GMT</pubDate></item></channel></rss>