diennea / carapaceproxy

A Distributed Java Reverse Proxy
Apache License 2.0
23 stars 9 forks source link

Support of Cache-Control header is only partial #462

Open NiccoMlt opened 2 months ago

NiccoMlt commented 2 months ago

While looking at the block code below to figure out if WebP images would be cached correctly:

https://github.com/diennea/carapaceproxy/blob/fe1cfdfec3c52a8f004ad9676a3e3a386f71a131/carapace-server/src/main/java/org/carapaceproxy/server/cache/ContentsCache.java#L188-L200

we figured out that caching strategy implemented by isChached methods is a little naïve. Taking a look the the actual code:

https://github.com/diennea/carapaceproxy/blob/fe1cfdfec3c52a8f004ad9676a3e3a386f71a131/carapace-server/src/main/java/org/carapaceproxy/server/cache/ContentsCache.java#L122-L131

https://github.com/diennea/carapaceproxy/blob/fe1cfdfec3c52a8f004ad9676a3e3a386f71a131/carapace-server/src/main/java/org/carapaceproxy/server/cache/ContentsCache.java#L155-L172

it is especially evident that we don't actually support all the Cache-Control values.

Request Response
max-age max-age
max-stale -
min-fresh -
- s-maxage
no-cache no-cache
no-store no-store
no-transform no-transform
only-if-cached -
- must-revalidate
- proxy-revalidate
- must-understand
- private
- public
- immutable
- stale-while-revalidate
stale-if-error stale-if-error