You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
jameslshannon
changed the title
Can't access Authorization header in framework middleware under Edge runtime
Cannot access NextRequest headers in framework middleware under Edge runtime
Mar 24, 2024
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.
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
The text was updated successfully, but these errors were encountered: