Custom Headers Nextjs13
Hello,
What is the correct way to access this custom header in next13?
Accessing the request.headers.secret used to work this way prior to updating but it is now undefined. I can see the value when I log request.headers as well as when I log my API_ROUTE_SECRET
any tips would be greatly appreciated
console.log(request.headers); // exists in here
console.log(request.headers.secret); // undefined
if (request.headers.secret !== process.env.API_ROUTE_SECRET) {
return NextResponse.json({
message: "You are not authorized to call this API",
});
}
What is the correct way to access this custom header in next13?
Accessing the request.headers.secret used to work this way prior to updating but it is now undefined. I can see the value when I log request.headers as well as when I log my API_ROUTE_SECRET
any tips would be greatly appreciated
console.log(request.headers); // exists in here
console.log(request.headers.secret); // undefined
if (request.headers.secret !== process.env.API_ROUTE_SECRET) {
return NextResponse.json({
message: "You are not authorized to call this API",
});
}
