Set max-age header to Amazon S3 resources

This commit is contained in:
Marcelo Dominguez 2013-03-08 13:59:12 -02:00
parent 88e76448b6
commit b950c4f171
4 changed files with 10 additions and 0 deletions

View file

@ -9,6 +9,7 @@
## Refactor
* Add a configuration entry to set max-age header to Amazon S3 resources. [#4048](https://github.com/diaspora/diaspora/pull/4048)
* Refactor people_controller#show and photos_controller#index [#4002](https://github.com/diaspora/diaspora/issues/4002)
## Features

View file

@ -18,6 +18,7 @@ defaults:
secret:
bucket:
region:
cache: true
image_redirect_url:
assets:
serve: false

View file

@ -76,6 +76,10 @@ configuration: ## Section
#bucket: 'my_photos'
#region: 'us-east-1'
# Use max-age header on Amazon S3 resources.
# this would set a max-age value of 1 year
#cache : true
## Related to S3 you can set a url to redirect all requests to uploaded
## images to another host. If you for example set
## https://images.example.org here, all requests made to

View file

@ -14,6 +14,10 @@ CarrierWave.configure do |config|
:aws_secret_access_key => AppConfig.environment.s3.secret.get,
:region => AppConfig.environment.s3.region.get
}
if AppConfig.environment.s3.cache?
config.fog_attributes['Cache-Control'] = 'max-age=31536000'
end
config.fog_directory = AppConfig.environment.s3.bucket.get
else
config.storage = :file