# Paperclip - Amazon S3 - https

**URL:** <https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993>\
**Category:** Rails\
**Created:** [August 9, 2010, 6:55pm UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993 "2010-08-09T18:55:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 9, 2010, 6:55pm UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/1 "2010-08-09T18:55:13Z")

</div>

I am able to use Paperclip to save files to Amazon’s S3 storage. Once  
saved, the files are available using a URL associated with the bucket  
and filename.

I have not been able to find a good tutorial which clearly explains  
how to save a file to S3 (using Paperclip) whereby it can only be  
retrieved using https, and only for a limited time period (which I  
understand is a function of S3).

My specific need is to upload the file from one web page, while  
allowing a user (who has logged into the site) to then (for a limited  
amount of time) to access that page using https and a link on a page  
served to that user.

Does anyone have good tutorial or example code which addresses this  
issue?

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 9, 2010, 9:18pm UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/2 "2010-08-09T21:18:03Z")

</div>

Take a look at:

[http://scottmotte.com/archives/181.html](http://scottmotte.com/archives/181.html)

Regards,  
Daniel GaytÃ¡n  
[http://survey.richapplabs.com/index.php?sid=62661&lang=en](http://survey.richapplabs.com/index.php?sid=62661&lang=en)

2010/8/9 Sandy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 10, 2010, 2:30am UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/3 "2010-08-10T02:30:39Z")

</div>

Daniel,

While I’m sure that you had good intentions, the tutorial to which you  
referred is absolutely unrelated to the question I asked.

Specifically, I clearly stated that I know how to use Paperclip to  
upload files to S3, and to create a url to retrieve the files. My  
question was whether anyone knew of a tutorial relating to https, as I  
am interested in being able to control access to the uploadeed files.

In the future, may I suggest that no answer is better than a wrong  
answer or guess, which simply makes others, who may know the answer,  
refrain from looking at the question.

Sandy

On Aug 9, 3:15 pm, Daniel Alejandro Gaytán Valencia

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 22, 2010, 1:37am UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/4 "2010-08-22T01:37:05Z")

</div>

On Aug 10, 12:29Â am, Colin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Specifically, I clearly stated that I know how to use Paperclip to  
> > messages and may make suggestions that they think may be helpful, but  
> > may not turn out to be so. Â You might to better by gracefully pointing  
> > out that the suggestion does not help and ask for further suggestions.

He started off by saying the poster had good intentions. I don’t see  
the problem. You on the other hand has done nothing but to gripe and  
lecture at everything OP has done.

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 10, 2010, 9:32am UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/5 "2010-08-10T09:32:40Z")

</div>

On 10 August 2010 01:29, Sandy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

Please don’t top post, it makes it difficult to follow the thread.  
Insert your reply at appropriate points in the previous mail. Thanks.

> In the future, may I suggest that no answer is better than a wrong  
> answer or guess, which simply makes others, who may know the answer,  
> refrain from looking at the question.

I don’t think that getting shirty with those trying to help is likely  
to get you anywhere. Often those reading mail only have time to skim  
messages and may make suggestions that they think may be helpful, but  
may not turn out to be so. You might to better by gracefully pointing  
out that the suggestion does not help and ask for further suggestions.

Colin

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [August 22, 2010, 4:09am UTC](https://www.ruby-forum.com/t/paperclip-amazon-s3-https/192993/6 "2010-08-22T04:09:22Z")

</div>

Sandy wrote:

> My specific need is to upload the file from one web page, while  
> allowing a user (who has logged into the site) to then (for a limited  
> amount of time) to access that page using https and a link on a page  
> served to that user.
> 
> Does anyone have good tutorial or example code which addresses this  
> issue?

I haven’t seen a tutorial for it, but you may want to take a look at the  
docs for aws-s3 here: [http://amazon.rubyforge.org/](http://amazon.rubyforge.org/)

Take a look at the section “Accessing private objects from a browser”,  
which goes into detail about SSL and link expiration. Paperclip also  
provides options for these settings, take a look at the docs for the S3  
module: [http://rdoc.info/projects/thoughtbot/paperclip](http://rdoc.info/projects/thoughtbot/paperclip)

Excerpt:

s3\_permissions: This is a String that should be one of the â€œcannedâ€  
access policies that S3 provides (more information can be found here:  
[docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html#RESTCannedAccessPolicies](http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html#RESTCannedAccessPolicies))  
The default for Paperclip is :public\_read.

s3\_protocol: The protocol for the URLs generated to your S3 assets. Can  
be either â€˜httpâ€™ or â€˜httpsâ€™. Defaults to â€˜httpâ€™ when your  
:s3\_permissions are :public\_read (the default), and â€˜httpsâ€™ when your  
:s3\_permissions are anything else.

s3\_headers: A hash of headers such as {â€˜Expiresâ€™ =\>  
1.year.from\_now.httpdate}

Hope this helps!
