z4nr34l / next-easy-middlewares

Missing polyfill for multiple next.js middlewares
https://next-easy-middlewares.vercel.app/
MIT License
87 stars 4 forks source link

multi middleware headers not applied, only last one is applied in response #44

Closed riazXrazor closed 1 month ago

riazXrazor commented 1 month ago

Hi, it seems only the last middleware header in the array is applied if i put it this way only csrf header is sent in response

const middlewares = {
    "/": [RatelimitMiddleware, csrfMiddleware],
};

middleware2

and putting this way only rate limit headers are sent

const middlewares = {
    "/": [csrfMiddleware, RatelimitMiddleware],
};

middleware1

here is sample project code

https://codesandbox.io/p/github/riazXrazor/nextjsmultimiddlewaretest/master?file=%2Fsrc%2Fmiddleware.ts&workspaceId=cfdd15f1-e875-4cef-bcb7-6f2812f84658

linear[bot] commented 1 month ago

NEM-14 Only last middleware header applied

z4nr34l commented 1 month ago

Hi, Thanks for reaching out!

Badly I cannot access this codesandbox vm :(

z4nr34l commented 1 month ago

I've managed to find your repository 😀 I'm already preparing an beta version which should fix that

z4nr34l commented 1 month ago

Issue will be fixed in upcoming release #49