Different cache behavior on prod vs. dev mode

Hello :)

There seems to be a difference in behavior in the way Play deals with assets caching when it is running in production mode compared when it is running in dev mode.

I’m running this sample project.

Dev mode:

$ curl -v 'http://localhost:9000/assets/stylesheets/main.css' 2>&1 | grep 'Cache'
< Cache-Control: no-cache

Production mode:

$ curl -v 'http://localhost:9000/assets/stylesheets/main.css' 2>&1 | grep 'Cache'
< Cache-Control: public, max-age=3600

Is this expected? I didn’t find it documented anywhere. :thinking:

Thanks!

Hi @LLCampos,

it’s true that’s not documented, but it’s the expected behavior. The idea is that in dev mode caching doesn’t make sense since you want to always serve the latest version of each asset (potentially changed).

Cheers,

1 Like