Skip to content

Conversation

@Faizanahmedsy
Copy link

@Faizanahmedsy Faizanahmedsy commented Dec 14, 2025

…ility

Migrate from the deprecated middleware.ts file convention to the new proxy.ts convention as required by Next.js 16.0.10.

The middleware file convention has been deprecated and renamed to 'proxy' to better clarify its purpose as a network boundary in front of the app, and to avoid confusion with Express.js middleware.

Changes:

  • Rename apps/site/middleware.ts to apps/site/proxy.ts
  • Add named export const proxy = createMiddleware({
  • Maintain full compatibility with next-intl internationalization
  • Update comments to reflect proxy terminology

This resolves the deprecation warning:
'The middleware file convention is deprecated. Please use proxy instead.'

Refs: https://nextjs.org/docs/messages/middleware-to-proxy

Description

Validation

Related Issues

Fixed #8418

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@Faizanahmedsy Faizanahmedsy requested review from a team as code owners December 14, 2025 14:00
@vercel
Copy link

vercel bot commented Dec 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 14, 2025 2:36pm

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export const proxy = createMiddleware({

You should just be able to do this, no?

@Faizanahmedsy
Copy link
Author

export const proxy = createMiddleware({

You should just be able to do this, no?

I have done as per documentation, but let me try if this similer approch works

…ility

Migrate from the deprecated middleware.ts file convention to the new
proxy.ts convention as required by Next.js 16.0.10.

The middleware file convention has been deprecated and renamed to 'proxy'
to better clarify its purpose as a network boundary in front of the app,
and to avoid confusion with Express.js middleware.

Changes:
- Rename apps/site/middleware.ts to apps/site/proxy.ts
- Add named export function 'proxy' instead of default export
- Add NextRequest type import for type safety
- Maintain full compatibility with next-intl internationalization
- Update comments to reflect proxy terminology

This resolves the deprecation warning:
'The middleware file convention is deprecated. Please use proxy instead.'

Refs: https://nextjs.org/docs/messages/middleware-to-proxy
Copy link
Member

@MattIPv4 MattIPv4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to this file in CODEOWNERS needs updating, please

@Faizanahmedsy
Copy link
Author

hi @avivkeller I amended the commit to incorporate this feedback. I've verified that both approaches work correctly, and all tests pass

import { availableLocaleCodes, defaultLocale } from '#site/next.locales.mjs';

export default createMiddleware({
// Migrated from middleware.ts to proxy.ts as per Next.js 16 deprecation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not needed

removed in the next commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire comment is not needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire comment is not needed

I have removed the comments that i added, but kept the comments that where already there please check now f4507a8

@Faizanahmedsy
Copy link
Author

The reference to this file in CODEOWNERS needs updating, please

okay checking that

@Faizanahmedsy
Copy link
Author

The reference to this file in CODEOWNERS needs updating, please

hi @MattIPv4 I have done that please check if I have done it correctly or not

- apps/site/middleware.ts @nodejs/web-infra
+ apps/site/proxy.ts @nodejs/web-infra

@avivkeller
Copy link
Member

The added comment is still not needed, you only removed half of it.

@Faizanahmedsy
Copy link
Author

The added comment is still not needed, you only removed half of it.

yeah sorry about that check now f4507a8

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't using the new middleware because it's not compatible with OpenNext. That was intentional. Blocking changes.

opennextjs/opennextjs-cloudflare#972

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Matt and Claudio still have concerns blockers, but LGTM regarding my previous blockers

@ovflowd
Copy link
Member

ovflowd commented Dec 14, 2025

Looks like Matt and Claudio still have concerns, but LGTM with my blockers

Not concerns. This actually cannot be merged, otherwise it breaks Cloudflare builds.

@ovflowd
Copy link
Member

ovflowd commented Dec 14, 2025

To be clear not against the changes, just, they cannot be merged meantime.

@Faizanahmedsy
Copy link
Author

Faizanahmedsy commented Dec 15, 2025

To be clear not against the changes, just, they cannot be merged meantime.

Okay 👍, I will try to remind you once Open Next Supports it

@ovflowd
Copy link
Member

ovflowd commented Dec 15, 2025

Thank you! You can keep the PR open although I'd recommend converting it back to a draft state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

since the middleware is depracated migrate to it is recommeed to migrate to proxy

4 participants