Skip to content

Cache-control not configured for static assets #491

Closed
@francisli

Description

@francisli

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Details about the bug:

Without any configuration, Express serve-static will set a max-age of 0 seconds on assets served. This prevents caching and could kill your server under heavy load. I'd suggest setting it to something like at least 1 day on production. Normally, I'd suggest cranking it up to something like a year, but right now, the problem is that there are a few static assets that are served directly without being processed by webpack- the p5-interceptor, loop-protect, etc, which means a very high cache time will prevent changes from being picked up without purging caches. If ALL source files were processed by webpack, then the unique filename fingerprints generated on every deployment would bust the cache so you could crank up the cache time.

I took a peek at the response headers coming from alpha.editor.p5js.org, and I don't see any indication that there's a CDN cache in front of your server. CloudFlare is very easy to use and free, assuming you have control over the domain and can move the nameservers to CloudFlare. If not, then I'd suggest configuring an AWS CloudFront distribution in front of your server or ELB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions