Are S3 upload urls supposed to have the http/https protocol included?

I’m exposing some upload urls over a custom api endpoint and anything that’s been uploaded to S3 returns something like the following in the rails console.

Upload.last.url
=> "//link-to-my-bucket.s3.dualstack......"

Rather than…

Upload.last.url
=> "https://link-to-my-bucket.s3.dualstack......"

Wanted to understand if this was expected behaviour and the protocol is being added on elsewhere?

Answering my own question.

It’s expected. UrlHelper.cook_url(url) is what you want.

1 Like

Although apparently this method does not add https:// to a non-CDN S3 URL. I had to add custom code to achieve this.

Hi James, how did you do it? My images are giving me 403 errors and no https

1 Like