remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

FR: support cache headers #150

Open jbfbell opened 7 years ago

jbfbell commented 7 years ago

Use case: Inlining the same url on a daily basis to get new updates

What happens: When requesting the same url on a daily basis, the url is cached so the inlining never updates, and returns the previously cached inlined html.

/lib/get.js it uses a cache based on the url alone and does not check any no-cache no-store headers. Workaround: add garbage unique values to the url like "#foo", which will bloat the cache or delete the require cache and reload the "get" module for Inliner.

Ask: Do not cache urls which have a no-cache header.

remy commented 7 years ago

That would take a bunch of work to read and replicable cache handling in the client. Happy to take a PR for this, but it's lower priority for core.

remy commented 7 years ago

An intermediate solution might be just not to cache if there's no cache headers, but there's a lot of variation to determine that, but probably simpler than a full cache parser.