Merge pull request #4048 from marpo60/s3_max_age

Set max-age header to Amazon S3 resources
This commit is contained in:
Jonne Haß 2013-03-10 06:14:49 -07:00
commit 97a8ff65ba
4 changed files with 10 additions and 0 deletions

View file

@ -11,6 +11,7 @@
## Refactor ## 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) * Refactor people_controller#show and photos_controller#index [#4002](https://github.com/diaspora/diaspora/issues/4002)
* Modularize layout [#3944](https://github.com/diaspora/diaspora/pull/3944) * Modularize layout [#3944](https://github.com/diaspora/diaspora/pull/3944)
* Add header to the sign up page [#3944](https://github.com/diaspora/diaspora/pull/3944) * Add header to the sign up page [#3944](https://github.com/diaspora/diaspora/pull/3944)

View file

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

View file

@ -75,6 +75,10 @@ configuration: ## Section
#secret: 'changeme' #secret: 'changeme'
#bucket: 'my_photos' #bucket: 'my_photos'
#region: 'us-east-1' #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 ## Related to S3 you can set a url to redirect all requests to uploaded
## images to another host. If you for example set ## images to another host. If you for example set

View file

@ -14,6 +14,10 @@ CarrierWave.configure do |config|
:aws_secret_access_key => AppConfig.environment.s3.secret.get, :aws_secret_access_key => AppConfig.environment.s3.secret.get,
:region => AppConfig.environment.s3.region.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 config.fog_directory = AppConfig.environment.s3.bucket.get
else else
config.storage = :file config.storage = :file