#middleware cause 400 error on routes
34 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message.
This feels like a problem in the reverse proxy, next js https is experimental so i would have to see your architecture and middleware to conclude @inland idol
@idle oracle @obsidian kite
I have this problem even if i have a simple middleware like :
export function middleware(request: NextRequest) {
return NextResponse.next()
}
My structure is :
src
app
components
middleware.ts
Ok but how is the traffic routed to the server
I did not understand
Is the next instance in https mode
Im isking if the traffic is decrypted before it hits the server
I did not touch my next config for https.
I was always worked with http.
The funny thing is when i remove my middleware, problem is gone and routes are ahown.
But when i put middleware my route and chunks are not load.
I have no idea what to do ;((
Huh well that is essential info
What info yoh need? Tell me to give it to you
Nope.
I was added matcher too. no effect
I would think
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico, sitemap.xml, robots.txt (metadata files)
/
'/((?!api|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).)',
],
}
If this doesn’t work
Then yeah not sure
In middleware add that*^
At bottom
Its possible but if it works without middleware i doubt it
Problem solved!
It was from webserver and haproxy(DevOps issues)
Thank you guys
Damn
It was Nextjs bug😧
Look at here :
https://github.com/vercel/next.js/issues/58764
Link to the code that reproduces this issue https://github.com/Jonas-PFX/NextJS-Dupe-Headers-Bug To Reproduce Start the application with npm run dev (or npm run build and npm run start). Make a cur...