Is there a way to configure the Middleman server’s headers (expires, cache-control)?
Hi @flachware. expires and cache control would be handled on the webserver level. I believe the only exception to this case in regards to middleman is if you’re serving content via S3 and our CloudFront you can set it on upload like so:
activate :s3_sync do |s3_sync|
... your settings here
end
caching_policy 'text/html', cache_control: {max_age: 7200, must_revalidate: true}, content_encoding: 'gzip'
caching_policy 'image/png', cache_control: {max_age: 31536000, public: true}, content_encoding: 'gzip'
caching_policy 'image/jpeg', cache_control: {max_age: 31536000, public: true}, content_encoding: 'gzip'
caching_policy 'text/css', cache_control: {max_age: 31536000, public: true}, content_encoding: 'gzip'
caching_policy 'application/javascript', cache_control: {max_age: 31536000, public: true}, content_encoding: 'gzip'
You want to make sure the caching_policy is after activating s3_sync.
Thank you for your fast response!