Caching of payload files

default discord avatar
6 months ago

By default, payload sets the


header to

public, max-age=0

on static assets.

1. Why not caching the JS/CSS/fonts/svg files since they could contain a hash in the filename to prevent cache issue for the user ?

2. Why does the


file doesn't contains any hash ?

  • discord user avatar
    Payload Team
    5 months ago

    @elliotyoyo This is a good idea for a feature enhancement. We use webpack which can definitly help with hashing. Are you interested in making a PR to Payload for this?

  • default discord avatar
    5 months ago

    Tried to play with the webpack configuration, hashing the style file should be as easy as

    filename: 'styles-[contenthash].css'


    I would like to make sure everything works fine but I don't understand how I can test the build version ?

    @dribbens Made PR
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.