get header in middleware
Unanswered
Persian posted this in #help-forum
PersianOP
hey, i try to to get a header that i set in nginx conf for the domain.
In my nginx conf
Now when I try to read this header in my NextJS application via middleware I get nothing back
When I call the page with Postman I get to see this header
In my nginx conf
add_header X-Test-Header "test";Now when I try to read this header in my NextJS application via middleware I get nothing back
import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const header = request.headers.get('X-Test-Header');
console.log(header);
}When I call the page with Postman I get to see this header