elixir-waffle / waffle

Flexible file upload and attachment library for Elixir
704 stars 70 forks source link

Signed URL with Cloudfront #104

Open tomasz-tomczyk opened 1 year ago

tomasz-tomczyk commented 1 year ago

Environment

Expected behavior

I was hoping to use Cloudfront with signed URLs and after configuring it in AWS, I confirmed it just works with both the Cloudfront URL and alternate domain I configured in Cloudfront by just changing the host of the URL generated by waffle/ex_aws:

App.Uploads.ProfilePhoto.url(:thumb, signed: true)
|> String.replace(
  "https://s3.eu-west-2.amazonaws.com/my-bucket-name/",
  "https://dhb50ml2ixxxx.cloudfront.net/"
)

I expected this to just happen if I was to configure the asset_host

Is there a better way to do this than add my own wrapper that changes the url?

Actual behavior

Generating a signed URL always returns a S3 URL

darwin67 commented 1 year ago

Same here. Would be nice that the asset_host is respected when using signed URLs.