Forum Discussion

tmbull's avatar
tmbull
Copper Contributor
Jun 03, 2025
Solved

Unable to load images in Link Unfurling Card

Hello, I am currently implementing the link unfurling feature, and am trying to include images. However, the images that are hosted by my service (currently deployed via ngrok for development purpose...
  • Ayush2001's avatar
    Jun 04, 2025

    Hello Tmbull,

    You're encountering this issue because Microsoft Teams' link unfurling uses a proxy service (urlp/v1/url/content) to retrieve and cache external images. This service enforces strict content-type and security requirements. The 415 "Unsupported Media Type" error likely stems from one of the following:

    🔍 Root Causes

    1. Content-Type Not Properly Set
      Teams expects image responses to include a valid Content-Type like image/png or image/jpeg. Ngrok sometimes serves images via local servers that misconfigure or omit this header.
    2. Missing Content-Length or CORS Headers
      If the image response lacks proper Content-Length or security headers (like Access-Control-Allow-Origin), Teams' proxy might reject it.
    3. Image Stream or Encoding Issues
      Serving images via dev servers (like Flask, Express, or even raw file streaming) may cause subtle issues, such as incorrect byte streams, that Teams interprets as corrupted.
    4. Ngrok Public URL Limitations
      While not explicitly banned, ngrok-free URLs can be rate-limited, ephemeral, or flagged for unusual activity. Microsoft documentation recommends them for debugging, but not guaranteed for content ingestion via production pipelines like urlp.

    ✅ Recommended Fixes

    1. Host Images on a Static CDN or Blob Storage
      Use Azure Blob Storage with public access or GitHub raw URLs (as you've already tested successfully) to ensure stable, compliant hosting.
    2. Verify Headers
      Ensure your image server returns: 
      Content-Type: image/png
      Content-Length: [exact byte size]
      Cache-Control: public, max-age=86400
      Avoid redirects and ensure direct delivery of the image 
    3. Use HTTPS with Valid Certificate
      Ngrok must serve over HTTPS with a valid TLS certificate. Teams will reject self-signed or invalid certs.
    4. Use Known-Compatible Hosts in Dev
      For development, tools like https://imgur.com/ or https://imagekit.io/ allow free image hosting and are trusted by Microsoft endpoints.

Resources