Skip to content

Commit

Permalink
🔧 chore (finance): Enabled CORS for API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanprince committed Feb 9, 2024
1 parent 2c03207 commit 792e040
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion apps/finance/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@
await import("./src/env.js");

/** @type {import("next").NextConfig} */
const config = {};
const config = {
async headers() {
return [
{
// Routes this applies to
source: "/api/(.*)",
// Headers
headers: [
// Allow for specific domains to have access or * for all
{
key: "Access-Control-Allow-Origin",
value: "*",
// DOES NOT WORK
// value: process.env.ALLOWED_ORIGIN,
},
// Allows for specific methods accepted
{
key: "Access-Control-Allow-Methods",
value: "GET, POST, PUT, DELETE, OPTIONS",
},
// Allows for specific headers accepted (These are a few standard ones)
{
key: "Access-Control-Allow-Headers",
value: "Content-Type, Authorization",
},
],
},
];
},
};

export default config;

0 comments on commit 792e040

Please sign in to comment.