Mar 18, 2022
0
Level 13
Serve dynamic images via s3 with proper headers
Hi,
I have a post model with 2 database columns (post slug & s3 url) & dynamic open graph image uploaded on s3. Now if I am integrating the image to posts using open graph image tag, Facebook has some issues regarding fetching it.
Embed code:
<meta property="og:image" content="https://e91f-122-161-51-149.ngrok.io/simpleurl/HALQdIPvMhjV97wLvMmWfjRgg6KwJjsD/image/?modifications=text_subtitle~~Yoyo~~~text_title~~Hello%20World~~~image_main~~https://picsum.photos/800"/>
It shows me following error:
Image not be processed as an image because it has an invalid content type.
However I am properly 301 redirecting the above open image url to S3 Url.
Let me know whats best way to serve image from S3 with proper headers without compromising on performance. Thanks.
Please or to participate in this conversation.