EdgeOne Pages Officially Launches Middleware Feature with Full Support for Next.js Middleware Edge Deployment

Chris ChenChris Chen
5 min read
Feb 6, 2026

edgeone pages middleware

We are excited to announce that EdgeOne Pages now officially supports middleware functionality. This means you can intercept and process user requests at edge nodes, execute custom logic before page loading, making your applications more responsive and your architecture more flexible.

Why Do You Need Middleware?

Middleware is code that executes before a request reaches its final destination. It can intercept user requests and perform operations such as redirects, rewrites, and header modifications. Think of it as a "gatekeeper" for requests, performing a round of filtering and preprocessing before formal processing begins.

In traditional architectures, this processing logic requires requests to be sent back to the origin server, which not only increases latency but also places additional burden on the origin. EdgeOne Pages middleware runs on edge nodes, moving these lightweight processing operations closer to users. Requests can be evaluated and processed before ever reaching the origin server.

Use Cases

Middleware application scenarios can be categorized as follows:

  • Traffic Management: Dynamically control request routing based on conditions such as path, domain, cookies, and geographic location to enable canary releases, A/B testing, and internationalization (i18n).
  • Security Protection: Complete token authentication, IP restrictions, geo-blocking, and Referer anti-hotlinking verification at the edge, intercepting malicious requests before they reach the origin server.
  • Performance Optimization: Return JSON, HTML, or redirect responses directly for specific requests, reducing unnecessary origin roundtrips and improving overall response speed.

Framework Support

EdgeOne Pages provides platform-level universal middleware services. Regardless of your technology stack, you can execute custom logic at edge nodes. We have also adapted to mainstream full-stack frameworks, allowing you to continue using your framework's native middleware syntax, which automatically runs on edge nodes after deployment.

Next.js

Pages now fully supports Next.js middleware, compatible with both Middleware (Next.js 12+) and Proxy (Next.js 16) syntax. Whichever approach you choose, the syntax remains consistent with official Next.js documentation. After deploying to Pages, middleware automatically runs on EdgeOne's edge nodes with no additional configuration required.

Astro

Astro middleware adaptation is currently in progress. We will provide support in upcoming releases, so stay tuned.

Get Started

The middleware feature is now available to all Pages users. Check out the documentation for more details. If you have any questions during use, feel free to join our Discord community for discussion and feedback.