-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix OGImage icon fetch on cloudflare #3253
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
|
Summary of the deployments: Version 1
Version 2
Test content |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
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.
Makes sense, the alternative was to set the header as well here, but I think it's better to unify between Vercel and Cloudflare on the way we fetch things here
I've started doing exactly that at first, but there is not much benefits in doing so (technically it's slightly faster), it just complicate things. |
When a request for OG Image arrives for a custom domain, the requested favicon is requested from the same domain (i.e.
https://thedomain.com/~gitbook/icon
)In Cloudflare, we were using a service binding, but by doing so, this bypass setting the
x-gitbook-url
header and thus the request will end up not being able to matchgetSiteUrlFromRequest
gitbook/packages/gitbook-v2/src/middleware.ts
Lines 382 to 391 in ba0094a
We should be fine without the service binding since we set
global_fetch_strictly_public
compatibility flagThe icon will return a 404 and the OG Image Generation will fail with a 500
Should fix RND-7140