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
I verified that the issue exists in Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64
Binaries:
Node: 16.13.0
npm: 8.1.0
Yarn: 3.2.0
pnpm: N/A
Relevant packages:
next: 12.1.5-canary.0
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
Chrome 99
How are you deploying your application? (if relevant)
aws, next start
Describe the Bug
Opening the issue again because for some reason the previous one was deleted (???)
We are using middleware in order to protect static assets from unauthenticated users.
Until v12.1.3 it was possible to protect them using middleware.
Currently, middleware is not invoked when fetching an asset, e.g. /_next/static/chunks/something.js or /_next/static/media/image.png
I do understand that this feature was not "officially" supported, but middleware should be invoked also for static assets.
An idea might be separating page/api middleware and static assets middleware (e.g under _next folder) or a custom configuration that supports it.
To Reproduce
• Add a middleware - pages/_middleware.js
• Observe that requests under _next path are not invoked
The text was updated successfully, but these errors were encountered:
With the most recent canary we have enabled back the ability to run middleware in front of static assets which means that this behaviour is back. Glad to see there are important use cases for it 🎉
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64 Binaries: Node: 16.13.0 npm: 8.1.0 Yarn: 3.2.0 pnpm: N/A Relevant packages: next: 12.1.5-canary.0 react: 17.0.2 react-dom: 17.0.2
What browser are you using? (if relevant)
Chrome 99
How are you deploying your application? (if relevant)
aws, next start
Describe the Bug
Opening the issue again because for some reason the previous one was deleted (???)
We are using middleware in order to protect static assets from unauthenticated users.
Until v12.1.3 it was possible to protect them using middleware.
Currently, middleware is not invoked when fetching an asset, e.g.
/_next/static/chunks/something.js
or/_next/static/media/image.png
Looks like its a result of #32601
Expected Behavior
I do understand that this feature was not "officially" supported, but middleware should be invoked also for static assets.
An idea might be separating page/api middleware and static assets middleware (e.g under _next folder) or a custom configuration that supports it.
To Reproduce
• Add a middleware - pages/_middleware.js
• Observe that requests under _next path are not invoked
The text was updated successfully, but these errors were encountered: