-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix cors and requestData errors (#59)
* fix cors and requestData errors * add support for static exports
- Loading branch information
Showing
4 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
output: 'export', | ||
async headers() { | ||
return [ | ||
{ | ||
// matching all API routes | ||
source: "/api/v1/: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" }, | ||
] | ||
} | ||
] | ||
}, | ||
async rewrites() { | ||
return [ | ||
{ | ||
source: '/api/v1/:path*', // Match all routes starting with /api/v1/ | ||
destination: 'http://localhost:8080/api/v1/:path*', // Proxy to backend server | ||
}, | ||
]; | ||
}, | ||
}; | ||
|
||
module.exports = nextConfig; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = | ||
{ async rewrites() { | ||
return [ | ||
{ | ||
source: '/api/v1/:path*', | ||
destination: 'http://localhost:8080/:path*' // Proxy to Backend | ||
} | ||
] | ||
}, | ||
output: 'export' | ||
}; | ||
|
||
export default nextConfig; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters