CORS

CORS headers are vital for securing your web application.

Setting CORS headers

Mage has a first party middleware to set CORS headers.

import { useCORS } from "@mage/app/cors";

app.use(
  useCORS({
    origins: ["https://example.com"],
  }),
);