-
Notifications
You must be signed in to change notification settings - Fork 433
feat(og): add cache headers for generated images #2086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for hyprnote-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote canceled.
|
📝 WalkthroughWalkthroughThe PR modifies the Netlify OG image edge function to add caching headers. Instead of directly returning the ImageResponse, the response is stored in a variable, three Netlify-specific caching headers are added (Netlify-CDN-Cache-Control, Cache-Control, and Netlify-Vary), then returned. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@yujonglee need to purge cache in netlify for og images |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/netlify/edge-functions/og.tsx (1)
319-323: Header mutation pattern looks good; double‑check cache TTL trade‑offsUsing an intermediate
ImageResponseand settingNetlify-CDN-Cache-Control,Cache-Control, andNetlify-Varyon it is a clean way to honorconfig.cache = "manual"and get CDN/browser + query-based caching in place. The semantics look correct.One thing to confirm:
max-age/s-maxage=31536000withimmutableeffectively treats each URL (including query) as frozen for a year. If blog/docs/changelog content can change while keeping the same OG URL, you may want a shorter TTL or a versioned query parameter to avoid very stale previews.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/netlify/edge-functions/og.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid creating a bunch of types/interfaces if they are not shared. Especially for function props, just inline them instead.
Never do manual state management for form/mutation. Use useForm (from tanstack-form) and useQuery/useMutation (from tanstack-query) instead for 99% of cases. Avoid patterns like setError.
If there are many classNames with conditional logic, usecn(import from@hypr/utils). It is similar toclsx. Always pass an array and split by logical grouping.
Usemotion/reactinstead offramer-motion.
Files:
apps/web/netlify/edge-functions/og.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Redirect rules - hyprnote
- GitHub Check: Header rules - hyprnote
- GitHub Check: Pages changed - hyprnote
- GitHub Check: ci
- GitHub Check: fmt
this pr is made to fix the following issue.
local dev

prod

the og endpoint seems to return the same image even though they're different.