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


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.


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.

Added storage and removed postgres

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

I uploaded two images to my public bucket

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.

@justindotpub are you setting the content-type when uploading the images as shown in External Uploads — Phoenix LiveView v0.20.3?

Thank you all for the quick responses. We are using Waffle, not LiveView uploads.

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

@justindotpub you will need to explicitly set the header as shown here waffle/lib/waffle/storage/s3.ex at master · elixir-waffle/waffle · GitHub


Thank you so much for the suggestion! :heart: 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.

1 Like

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.

1 Like

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