- Newest
- Most votes
- Most comments
It's possible that CloudFront is causing the issue with the social sharing on Twitter and LinkedIn.
When a request is made to CloudFront, it checks the cache for a response before forwarding the request to the origin. If a cached response is found, CloudFront returns it to the viewer without forwarding the request to the origin. In your case, since the Lambda@Edge function is modifying the meta tags for rich social sharing, it's possible that the cached response does not contain the updated meta tags.
One way to test this is to invalidate the cache for the specific pages that contain the meta tags for rich social sharing. This will force CloudFront to forward the request to the origin, which will then trigger the Lambda@Edge function to update the meta tags.
Another thing you can do is to check the headers sent by the Twitterbot or LinkedIn bot and make sure the headers match the headers sent by other clients.
You can also check the CloudFront access logs to see if there are any errors related to the requests made by the Twitterbot or LinkedIn bot.
If none of the above solutions work, it's possible that the issue is with the Lambda@Edge function and the way it's modifying the meta tags. You can try to check the logs of the Lambda function to see if there are any errors that could cause the problem.
Finally, you can also try using another caching option instead of CloudFront, like using a CDN (Content Delivery Network) such as Cloudflare or Akamai, that might work better with your use case.
Relevant content
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thanks for the detailed answer - it helped me narrow down the cause: I needed to add a header to the response - Content-Type of text/html. Facebook could obviously parse the response without the header, but LinkedIn and Twitter couldn't.