Giter Site home page Giter Site logo

Cache-control about send HOT 2 CLOSED

pillarjs avatar pillarjs commented on September 14, 2024
Cache-control

from send.

Comments (2)

dougwilson avatar dougwilson commented on September 14, 2024

Hi, what about option to clean Cache-control on 206 and 304 responses?

I looked into this and it seems like having them on those responses are valid. Can you explain why you need to clean them for me?

nginx cache they and will send 206 instead 200 on every requests for example.

I'm not sure what this means, can you explain? I use nginx cache in front of this module and it has no issues with the Cache-Control header being there.

or just 'post-header event', to clean it without setHeader overriding.

That is beyond the scope of this module. You'll want to use something like https://www.npmjs.org/package/on-headers#readme :

onHeaders(res, function(){
  if (this.statusCode === 206 || this.statusCode === 304) {
    this.removeHeader('Cache-Control')
  }
})

send(req, url).pipe(res)

from send.

romankoblov avatar romankoblov commented on September 14, 2024

If you have nginx or cdn with nginx on front with cache and first request response is 206 or 304, it will cache it to url and next users will get that cache instead 200. There is settings in nginx to cache only 200 responses, but then it will cache all 200 pages even if there is no cache-control. Anyway, I re-read RFC, and Cache-Control should be set on 304 responses, so need to use other way to not cache these responses on nginx.

from send.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.