Man, thank you for this tutorial! I was stuck for hours trying to figure out why my middleware wasn't working. I had placed the middleware file in the app folder and tried debugging it, but nothing worked. Then, I found your video and learned to place the middleware outside the app folder-and it worked!
so i have setup my middleware and redirect to login page if its not logged in and after login i setup an encodedOriginUrl to go back to that requested page, but can i check if theres a page exist or not in my apps inside middleware? so the user should not go to login page and after login they found that the page is not found, so i just want the user just directly redirect to not found page and not login page if the page doesnt exist in my apps
I am frustrated at the moment. I am using server actions eg for database queries. However, whatever I do, I cannot protect the server function from being accessed from anyone from the client side. The function is in a folder utils alongside app. The can use it from client side but so can anyone! I have looked everywhere, but I cannot seem to find how to handle that…
My Cookies are exist in normal api call but when I call 2nd api call in service worker notification FCM , I don't get firebase cookies in Next.js api . Is it cross origin issue ?
Man, thank you for this tutorial! I was stuck for hours trying to figure out why my middleware wasn't working. I had placed the middleware file in the app folder and tried debugging it, but nothing worked. Then, I found your video and learned to place the middleware outside the app folder-and it worked!
Happy it helped!
short and understable! without any unnecessary things! thanks man!!
You’re welcome!
No bs with an example and straight to the point. Thank you!
You’re welcome!
This was just what I needed. Thank you very much. Simple and easy to understand.
So straight forward and easy to understand. Thank you
You’re welcome
Thanks for doing this video Ryan. I was stuck on this for 2 days lol
Happy it helped!
This is a really helpful compliment their docs. Thank you!!
You’re welcome!
Thank you so much. Very clean and this is what I needed!
Happy to hear it!
Thank you for such a simple tutorial
You’re welcome
Hey, i like this, so easy to make, thanks bro, greetings from Argentina.
You’re welcome!
Crazy, so that fixed my JWT authentication protected route problem
Really helpful better than the HOC approach
how do i make it dynamic? without changing user manually in middleware
export const config = {
matcher: ['/((?!api|_next/static|_next/image|.*\\.png$).*)']
};
With this you can run your middleware on every request
@@benjaoliva3383 he's asking how do you know whether the user is logged in or not
Super helpful! Thanks for creating this
Thanks. Good feature
If you have a src folder, try placing it in there. My middleware didn't run until I did that.
D@mn true, I appreciate ya
Legend! I was stuck on this for ages, thanks!
what if i want to have multiple middleware functions? where would they go since we have only one middlware.js file and one export for config
so i have setup my middleware and redirect to login page if its not logged in and after login i setup an encodedOriginUrl to go back to that requested page, but can i check if theres a page exist or not in my apps inside middleware? so the user should not go to login page and after login they found that the page is not found, so i just want the user just directly redirect to not found page and not login page if the page doesnt exist in my apps
I am frustrated at the moment. I am using server actions eg for database queries. However, whatever I do, I cannot protect the server function from being accessed from anyone from the client side. The function is in a folder utils alongside app. The can use it from client side but so can anyone! I have looked everywhere, but I cannot seem to find how to handle that…
but while creating a build the middleware.ts file doesn't work then what will be the solution for that edge case ?
My Cookies are exist in normal api call but when I call 2nd api call in service worker notification FCM , I don't get firebase cookies in Next.js api . Is it cross origin issue ?
Middleware making the routing slower, any solution?
Winter is coming, 😂 i spy a game of thrones fan
thnx
You’re welcome
Wonderful🤍
Thank you!