Closed jameslshannon closed 5 months ago
Thanks, this is about to get fixed in the next release with #144 that improves the support for handling forms. The request object is currently incorrectly cloned for the middleware functions causing the headers not be present there.
After upgrading to 6.0.0-beta.1
you should see this addressed.
Node 18.18.2, Next JS 14.1.3 and framework 5.1.11
When I run the above code using Vercel dev under the standard Node runtime locally I get 3 successful logs of the Authorization header, but when I run it under the Edge runtime locally I only get the final log of the Authorization header, so for some reason the middleware NextRequest doesn't have the Authorization header in Edge runtime - even though my main Next middleware can access it fine. Other properties of the NextRequest object seem to be available in the middleware apart from any of the headers.
The framework middleware would be a great place to enforce handler-specific authorization rules if access to the request headers was supported.
Thanks,
James