@@ -129,6 +129,26 @@ const nextConfig: NextConfig = {
129129 { key : 'Access-Control-Allow-Headers' , value : 'Content-Type, Accept' } ,
130130 ] ,
131131 } ,
132+ {
133+ // API routes CORS headers
134+ source : '/api/:path*' ,
135+ headers : [
136+ { key : 'Access-Control-Allow-Credentials' , value : 'true' } ,
137+ {
138+ key : 'Access-Control-Allow-Origin' ,
139+ value : env . NEXT_PUBLIC_APP_URL || 'http://localhost:3001' ,
140+ } ,
141+ {
142+ key : 'Access-Control-Allow-Methods' ,
143+ value : 'GET,POST,OPTIONS,PUT,DELETE' ,
144+ } ,
145+ {
146+ key : 'Access-Control-Allow-Headers' ,
147+ value :
148+ 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key, Authorization' ,
149+ } ,
150+ ] ,
151+ } ,
132152 {
133153 source : '/api/auth/oauth2/:path*' ,
134154 headers : [
@@ -156,26 +176,6 @@ const nextConfig: NextConfig = {
156176 { key : 'Access-Control-Allow-Headers' , value : 'Content-Type, Accept' } ,
157177 ] ,
158178 } ,
159- {
160- // API routes CORS headers
161- source : '/api/:path*' ,
162- headers : [
163- { key : 'Access-Control-Allow-Credentials' , value : 'true' } ,
164- {
165- key : 'Access-Control-Allow-Origin' ,
166- value : env . NEXT_PUBLIC_APP_URL || 'http://localhost:3001' ,
167- } ,
168- {
169- key : 'Access-Control-Allow-Methods' ,
170- value : 'GET,POST,OPTIONS,PUT,DELETE' ,
171- } ,
172- {
173- key : 'Access-Control-Allow-Headers' ,
174- value :
175- 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-API-Key, Authorization' ,
176- } ,
177- ] ,
178- } ,
179179 // For workflow execution API endpoints
180180 {
181181 source : '/api/workflows/:id/execute' ,
0 commit comments