The Next.js Middleware is not displaying the data when I try to access request.headers
.
If I attempt to retrieve other information, it appears without issue. However, attempting to display headers results in an error:
Server Error
TypeError: Cannot delete property 'Symbol(set-cookie)' of #<HeadersList2>
export function middleware(request) {
console.log(request.credentials); // show -> same-origin
console.log(request.method); // show -> GET
console.log(request.headers); // page error
console.log(request.headers.referer); // not show / undefined
}
export const config = {
matcher: "/:path*/generate",
};
Attempting to populate the request variable with data:
https://i.sstatic.net/m90iX.png
Error encountered when trying to display request.headers
: