martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
415 stars 22 forks source link

Make it possible to configure the max age of assets served by the `AssetServing` middleware #221

Closed ellmetha closed 4 months ago

ellmetha commented 6 months ago

Description

Right now the way the Marten::Middleware::AssetServing middleware behaves can't be configured. This middleware hardcodes the max age of served assets (3600 seconds), and it is not possible to easily override it if necessary. Let's ensure that this value can be configured easily.

Proposition

Let's introduce a new assets.max_age setting. This setting should allow setting the max age as used in the Cache-Control header set by the Marten::Middleware::AssetServing middleware, and the default value should be 3600s. It should be made clear in the documentation that this setting only applies when the Marten::Middleware::AssetServing middleware is enabled.