node-static icon indicating copy to clipboard operation
node-static copied to clipboard

Cache cannot be disabled with cli

Open cphoover opened this issue 8 years ago • 4 comments

I'm trying to disable cache in the CLI

I've tried

static -c 0 ., static -c false ., static -c 0 ., and static --cache=false .

None of these combinations work.

cphoover avatar Apr 27 '17 17:04 cphoover

Fixed by PR: https://github.com/cloudhead/node-static/pull/189

cphoover avatar Apr 27 '17 17:04 cphoover

Any updates here? can this PR be merged? if not, can you please give us a hint how to disable cache in CLI mode? The best I got so far was: static -H '{"Cache-Control": "no-cache, must-revalidate"}'

then as a result I had 2 headers in the response:

Cache-Control: no-cache, must-revalidate
cache-control: max-age=3600

which is a bit confusing

jakubwolny avatar Nov 29 '17 10:11 jakubwolny

seconded - can we get the PR merged?

elliotrodriguez avatar Dec 02 '17 17:12 elliotrodriguez

The programmatic cache option is weird too:

const st = require('node-static');
const fileServer = new st.Server(path, {
  cache: 0,
  headers: {
    'Cache-Control': 'no-cache, must-revalidate',
  },
});

Results in dual cache-control headers as well, like:

cache-control: max-age=0
Cache-Control: no-cache, must-revalidate

While the CLI seems to interpret static -c 0 as a falsy value, and falls back to the default, resulting in:

cache-control: max-age=3600

klebba avatar Jan 03 '18 20:01 klebba