mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-04-19 19:01:19 +00:00
Add cors headers to all api routes, with deployment as origin
This commit is contained in:
parent
dc61827f86
commit
a8c9ab7f68
@ -24,6 +24,27 @@ module.exports = removeImports({
|
||||
}
|
||||
];
|
||||
},
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
headers: [
|
||||
{
|
||||
key: "Access-Control-Allow-Origin",
|
||||
value: "https://plebdevs-three.vercel.app", // Set your origin
|
||||
},
|
||||
{
|
||||
key: "Access-Control-Allow-Methods",
|
||||
value: "GET, POST, PUT, DELETE, OPTIONS",
|
||||
},
|
||||
{
|
||||
key: "Access-Control-Allow-Headers",
|
||||
value: "Content-Type, Authorization",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
env: {
|
||||
KV_URL: process.env.NODE_ENV !== 'production'
|
||||
? process.env.REDIS_URL
|
||||
|
@ -53,8 +53,6 @@ export default async function middleware(request) {
|
||||
`ratelimit_middleware_${ip}`
|
||||
);
|
||||
|
||||
console.log("headers", request.headers)
|
||||
|
||||
if (!success) {
|
||||
return new NextResponse('Too Many Requests', {
|
||||
status: 429,
|
||||
|
Loading…
x
Reference in New Issue
Block a user