#Using cookies in middleware disables cacheing for the whole application?
28 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)
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
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
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?
it does yeah
so if you want to cache stuff, we do a workaround
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
I see that make sense now, i was so confused 😄
Next 14 is a weird thing on its own
@raven timber any reason why middleware dosent cache stuff?
mhm xD
wait for alfon if he knows why middleware dosent cache stuff
alfon the cache guy
Sure I'll wait, then mark the answer, thanks though
yup :D
#discussions message
@still jacinth
Thanks