# Signed URL for image in Tigris forces download instead of displaying inline

**URL:** <https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956>\
**Category:** General\
**Tags:** elixir, storage, tigris, login-only\
**Created:** [January 31, 2024, 2:36pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956 "2024-01-31T14:36:22Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![justindotpub](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justindotpub/32/48483_2.png) [@justindotpub](https://community.fly.io/u/justindotpub)\
**Post date:** [January 31, 2024, 2:36pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/1 "2024-01-31T14:36:23Z")

</div>

Hi,

My project (elixir/phoenix) has code that displays uploaded images from S3 using signed URLs. The exact same code using S3 displayed the image inline. With Tigris it doesn’t display, but if I open the image URL in a separate tab it forces the image to be downloaded. I’m assuming it has something to do with content-type not being detected properly.

I’m going to dig into the code but thought I’d share here in case anyone else runs into something similar or in case something needs to be changed on the Tigris side.

Thanks.  
Justin

---

<div class="post-metadata">

**Author:** ![jmj](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jmj/32/17762_2.png) [@jmj](https://community.fly.io/u/jmj)\
**Post date:** [January 31, 2024, 10:14pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/2 "2024-01-31T22:14:10Z")

</div>

> [@justindotpub](#):
>
> I’m going to dig into the code but thought I’d share here in case anyone else runs into something similar or in case something needs to be changed on the Tigris side.

Hi @justindotpub - yes it is due to the response header (I believe it is Content-Disposition). I will get back to you regarding this on what will be our plan to support this shortly.

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [January 31, 2024, 10:28pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/3 "2024-01-31T22:28:31Z")

</div>

Added #storage and removed #postgres

---

<div class="post-metadata">

**Author:** ![jmj](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jmj/32/17762_2.png) [@jmj](https://community.fly.io/u/jmj)\
**Post date:** [January 31, 2024, 10:36pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/4 "2024-01-31T22:36:56Z")

</div>

Hi @justindotpub can you provide an example image that downloads (vs inline render) for your case?

---

<div class="post-metadata">

**Author:** ![jmj](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jmj/32/17762_2.png) [@jmj](https://community.fly.io/u/jmj)\
**Post date:** [January 31, 2024, 10:39pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/5 "2024-01-31T22:39:28Z")

</div>

I uploaded two images to my public bucket

`https://fly.storage.tigris.dev/jmj-test-public/profile1.png`  
`https://fly.storage.tigris.dev/jmj-test-public/profile.png`

profile1.png renders inline because I set content-type to `image/png` during `put-object` and profile.png downloads because the default content-type is `binary/octet-stream` when not set explicitly.

---

<div class="post-metadata">

**Author:** ![ovaistariq](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/ovaistariq/32/39721_2.png) [@ovaistariq](https://community.fly.io/u/ovaistariq)\
**Post date:** [January 31, 2024, 11:21pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/6 "2024-01-31T23:21:58Z")

</div>

@justindotpub are you setting the content-type when uploading the images as shown in [External Uploads — Phoenix LiveView v0.20.3](https://hexdocs.pm/phoenix_live_view/uploads-external.html)?

---

<div class="post-metadata">

**Author:** ![justindotpub](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justindotpub/32/48483_2.png) [@justindotpub](https://community.fly.io/u/justindotpub)\
**Post date:** [February 2, 2024, 3:25pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/7 "2024-02-02T15:25:03Z")

</div>

Thank you all for the quick responses. We are using [Waffle](https://hex.pm/packages/waffle), not LiveView uploads.

I’ll need to spend some more time debugging to see exactly what Waffle is doing.

---

<div class="post-metadata">

**Author:** ![jstiebs](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jstiebs/32/8602_2.png) [@jstiebs](https://community.fly.io/u/jstiebs)\
**Post date:** [February 2, 2024, 3:34pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/8 "2024-02-02T15:34:09Z")

</div>

@justindotpub you will need to explicitly set the header as shown here [waffle/lib/waffle/storage/s3.ex at master · elixir-waffle/waffle · GitHub](https://github.com/elixir-waffle/waffle/blob/master/lib/waffle/storage/s3.ex#L99C1-L108C1)

---

<div class="post-metadata">

**Author:** ![justindotpub](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/justindotpub/32/48483_2.png) [@justindotpub](https://community.fly.io/u/justindotpub)\
**Post date:** [February 2, 2024, 6:28pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/9 "2024-02-02T18:28:50Z")

</div>

Thank you so much for the suggestion! ❤ It turns out this was a stupid mistake on my part. I forgot to update our content security policies `image-src` from Amazon to Tigris. All is well, and no code changes were needed compared to what worked in S3.

This does bring up another question… does Tigris support custom domain names, so that my CSP can allowlist our own domain instead of all of tigris? Or perhaps I need to convert to virtual host style URLs ala [Public Bucket | Tigris Object Storage Documentation](https://www.tigrisdata.com/docs/buckets/public-bucket/#virtual-hostedstyle-request).

---

<div class="post-metadata">

**Author:** ![ovaistariq](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/ovaistariq/32/39721_2.png) [@ovaistariq](https://community.fly.io/u/ovaistariq)\
**Post date:** [February 2, 2024, 7:16pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/10 "2024-02-02T19:16:44Z")

</div>

I am glad you were able to resolve this.

Regarding your question about custom domain names, this feature is in the works and should be ready in the next couple of days. In the meantime, you could continue using virtual host style URLs.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [February 9, 2024, 7:17pm UTC](https://community.fly.io/t/signed-url-for-image-in-tigris-forces-download-instead-of-displaying-inline/17956/11 "2024-02-09T19:17:10Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
