#Using cookies in middleware disables cacheing for the whole application?

28 messages · Page 1 of 1 (latest)

still jacinth
#

As mentioned in the question is cookies used in the middleware disables cacheing?

elfin marlinBOT
#

🔎 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)

boreal sparrow
#

nope, your fetch requests in the middleware arent cached and cant be cached

#

but your site still has caching

#

thats how you can cache your fetch requests in the middleware

#

@still jacinth

still jacinth
#

I see, then what would u say about that that I have a middleware that is basically calling a getSession function that gets the token from the cookie, which was set by the login function above, and on all of my routes console does say cache: SKIP

boreal sparrow
#

ok so @still jacinth middleware runs on every request

#

since as i mentioned before, fetches from your middleware directly are never cached'

#

hence the skips

#

makes sense?

still jacinth
#

it does yeah

boreal sparrow
#

where we make a server action, and call that server action.. so technically its not your middleware making the request, its your middleware making a request to a server action which makes the request

#

obviously this makes the action a public endpoint as we were disucssing on #discussions but thats what i do

still jacinth
#

I see that make sense now, i was so confused 😄

boreal sparrow
#

No worries, its a weird thing

#

Some of nextjs stuff are...questionable

still jacinth
#

Next 14 is a weird thing on its own

boreal sparrow
#

@raven timber any reason why middleware dosent cache stuff?

boreal sparrow
#

alfon the cache guy

still jacinth
#

Sure I'll wait, then mark the answer, thanks though

boreal sparrow
#

yup :D

boreal sparrow
#

#discussions message

@still jacinth

still jacinth
#

Thanks