weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.86k stars 187 forks source link

Allow arbitrary max-age parameter #292

Closed niutech closed 2 years ago

niutech commented 3 years ago

Please allow arbitrary max-age parameter for Cache-Control header, such as 1d or 7d instead of only 31d, 62d, 93d and 186d. What's the technical problem with making it n days? Just remove this switch statement. For me, 31 days is too long.

andrieslouw commented 3 years ago

You could remove the switch statement from the source to use it on your own server(s). It is some older implementation with two reasons: 1. CloudFlare only had specific options which worked with the max-age, but this is solved now. 2. We don't want to have shorter max-ages than 1 day, as it would be unfeasible to host the free service without any caching.

@kleisauke : Can we make it any number of days?

kleisauke commented 2 years ago

This has been fixed with commit e7ea2710b424ed96423277d2a1df7ca94505a88d, which has just been rolled out to production. Thanks for reporting this!

niutech commented 2 years ago

Thank you!