Caching of payload files

default discord avatar
elliotyoyo
6 months ago
2

By default, payload sets the

cache-control

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

style.css

file doesn't contains any hash ?

  • discord user avatar
    dribbens
    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
    elliotyoyo
    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

    https://github.com/payloadcms/payload/pull/2500
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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