elixir-waffle/waffle

Signed URL with Cloudfront

Opened this issue · 1 comments

Environment

  • Elixir version (elixir -v): 1.14.0-rc.0
  • Waffle version (mix deps): 1.1
  • Waffle dependencies when applicable (mix deps): N/A
  • Operating system: OSX / Alpine

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

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