Skip to content

Cache cannot be disabled with cli #188

Closed

Description

@cphoover

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.

Activity

  1. added 2 commits that reference this issue on Apr 27, 2017
  2. cphoover commented on Apr 27, 2017

    @cphoover
    Author

    Fixed by PR: #189

  3. added 2 commits that reference this issue on Apr 27, 2017
  4. jakubwolny commented on Nov 29, 2017

    @jakubwolny

    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

  5. elliotrodriguez commented on Dec 2, 2017

    @elliotrodriguez

    seconded - can we get the PR merged?

  6. klebba commented on Jan 3, 2018

    @klebba

    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
    
  7. brettz9 commented on Oct 15, 2025

    @brettz9
    Collaborator

    Setting -c or cache to false or 0 works in master, so closing (though feel free to comment further as needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions