Skip to content

og:image preview bails out if Content-Length header is missing, many image CDNs use streaming or chunked encoding now #6645

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

Open
2 tasks done
jonsherrard opened this issue Oct 18, 2023 · 2 comments · May be fixed by #7046
Open
2 tasks done
Labels

Comments

@jonsherrard
Copy link

  • I have searched open and closed issues for duplicates
  • I am using Signal-Desktop as provided by the Signal team, not a 3rd-party package.

Bug Description

Steps to Reproduce

  1. step one
    Open a chat
  2. step two
    Paste https://vercel.com/docs/functions/edge-functions/og-image-generation
  3. step three
    Notice there is no OG image loaded.

Actual Result:

No image preview is laoded in the chat is because vercel's image servers don't set a content-length, so it bails out:

if (contentLength > MAX_IMAGE_CONTENT_LENGTH) {

Expected Result:

The image preview should load.

Screenshots

Signal:
image

Other chat app:
image

Platform Info

Signal Version:

6.34.1
production (Apple silicon)

Operating System:

14.0 (23A344)

Linked Device Version:

@der-eismann
Copy link

der-eismann commented Oct 9, 2024

We just stumbled upon the same issue with our website, where we serve images from CloudFront with compression enabled. Since CloudFront dismisses the Content-Length header on compressed requests, we are not getting any preview images.
Would be great if we could find a solution for this, especially since the mobile app is not affected by this.

FTR these are the headers served by CloudFront:

< HTTP/2 200 
< content-type: image/jpeg
< date: Wed, 09 Oct 2024 16:49:57 GMT
< cache-control: max-age=315360000,public
< etag: "3b0c79e2613…"
< expires: Sat, 07 Oct 2034 16:49:57 GMT
< vary: Accept
< x-cache: Miss from cloudfront
< via: 1.1 ….cloudfront.net (CloudFront)
< x-amz-cf-pop: …
< alt-svc: h3=":443"; ma=86400
< x-amz-cf-id: skD88pp1R…

@ryan-williams
Copy link

ryan-williams commented Apr 29, 2025

This issue has driven me crazy, for years(?). OG images for my sites are frequently broken on Signal macOS and Android.

I hope someone reviews #7046 soon, it's been open for over 6 months. cc @scottnonnenberg-signal.

Here's a simple example: https://runsascoded.s3.amazonaws.com/og/test1.html. The og:image works in every service I've tried:

Facebook/X/LinkedIn/Discord ✅

c/o opengraph.xyz:

Screenshot 2025-04-29 at 1 31 12 AM

WhatsApp ✅ image
Slack ✅

image

but Signal Desktop or Android are broken ❌:

Image

Last time I hit this (signalapp/Signal-iOS#5559 (comment)), switching PNG to JPG fixed it for some reason, but that's not working for me this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants