-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aws::S3::Object#presigned_url does not allow :secure option #1169
Comments
It works for me (examples from s3.resource.bucket('foo').object('bar').presigned_url(:get) #=> "https://foo.s3.amazonaws.com/bar?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAKEY%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160427T163755Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=dfb94310e64c5352534891e574cba7ce6e0e740f649053b173820014d28f92a2"
s3.resource.bucket('foo').object('bar').presigned_url(:get, secure: false) #=> "http://foo.s3.amazonaws.com/bar?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAKEY%2F20160427%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160427T163803Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=22a965dd9cedbaf468e26d612c2dffa8586173860180747e39616a01f6cc0d6d" What version are you using? The confusion may be the fact that you're not seeing |
Yeah, the doc does not mention that. Also if I set |
That's correct. I'm not sure off the top of my head why that was, let me get back to you on that. |
#786 has the extended discussion on why you can't use HTTPS with virtual hosts. In short, because missing security certificates in those cases. Do you have a case where you need HTTPS for virtual hosts? |
@awood45 thanks for the quick reply. I found I may misunderstood this virtual host thing. So we are trying move from object.url_for(:read, expires: 7.days.to_i, secure: true, endpoint: '...', force_path_style: true) Since the Now looks like I can just pass the Aws::S3::Resource.new(endpoint: '...').bucket('foo').object('bar').presigned_url(...) |
@steventen Can you provide more context to why and what you were providing as The |
So we want to provide customers with download links for the files stored in s3. And these links must have expiration time. We want to use our own domain name for these links. We haven't really enabled the So looks like in order to acheive what we want, we have to use the domain name as the bucket name, and we can only use http? |
@steventen Thats correct. Your bucket name must be the cname you register as the virtual host. In addition to that, the request would have to be HTTP, not HTTPs. |
@awood45 I have a use case where I want to serve virtual host content behind a cloudfront distribution with https enabled. Know of any workaround for this? Not very useful but the code is here: https://github.com/AndrewVos/anmo/blob/master/app/controllers/aws_controller.rb#L23 |
Hi, there
It looks like the #presigned_url method for s3 object does not allow
:secure
option to pass in.Is there a reason for that?
Thanks
The text was updated successfully, but these errors were encountered: