Does anyone have a good way to avoid opting out of caching when reading headers/cookies?

Hopefully this isn't a super noob question, but I've done some research, and I don't think it's a trivial problem. If you have an app that uses cookies/headers to render something SSR with NextJS using the app router, is there any way to get NextJS to not opt out that route from setting the Cache-Control response header to something that allows caching? From what I understand, if you use a dynamic function within a route, Next will opt you out of caching and there's no way to tell it that you can cache responses using one of those headers/cookies as part of the cache key, knowing that your response is unique to that value.
0 Replies
No replies yetBe the first to reply to this messageJoin