pages functions middleware help
I have issue with middleware, i need to change in middleware authorization header from response, to use it in next requests in /api folder, but it doesnt changing.
11 Replies
You can't use Pages Middleware with Next.js if that is what you mean
I dont using next.js
I mean that i use middleware to change authorization header before it will proceed in /api folder (functions), but authorization header doesnt change
Just checking, are you calling
next
before changing the Authorization header?Yep
Is that root of issue?
Yeah. Once you call next, then it consumes the Request. After that, you can modify it, but you have already used the old one
Modify the Request Headers, then call
next()
Oh, yeah, my fault, ty
All good!
Still have in /api functions old header 'Authorization'
solved
Also ty for good advice!