Coder Social home page Coder Social logo

304s for unmodified files about serve HOT 9 CLOSED

vercel avatar vercel commented on June 29, 2024
304s for unmodified files

from serve.

Comments (9)

leo avatar leo commented on June 29, 2024

I've tried to make it work in 6bd5031 (it should, but it sadly doesn't, I think). Will take another stab at it soon!

from serve.

kevin-roark avatar kevin-roark commented on June 29, 2024

nice! I may have spotted a bug (I'll comment on the commit) but I also could be wrong :)

from serve.

leo avatar leo commented on June 29, 2024

Sadly, that wasn't the problem. I've tried a few things, but nothing seems to work. The main problem is probably that the files (except the assets of micro-list itself) don't even get saved to the cache. Maybe @rauchg can take a stab at this?

All in all, the request doesn't contain the "if-modified-since" header (except when it's an asset, like I said).

from serve.

rauchg avatar rauchg commented on June 29, 2024

@leo you must supply an ETag first with every file, which could be a very quick hashing function (like crc32) concatenated file mtime

from serve.

leo avatar leo commented on June 29, 2024

Should be fixed in v0.5.0!

from serve.

slorber avatar slorber commented on June 29, 2024

Hey,

Just wondering if it's possible to get more infos on how caching really works.

Let's suppose I build my frontend at t1 and produce 2 files vendor.js and app.js, and serve them on now-serve. As I would use it as a CDN, I want caching to kick in.
Now let's supposed I build frontend at t2 and produce the same 2 files that I redeploy with now-serve.

On second deploy, vendor.js is exactly the same as before (because my app libs did not change), but app.js is different (using hash compare is enought).

Will the headers be correctly set to enforce that the user see immediately the changes to app.js, and get a 304 for vendor.js ?

from serve.

slorber avatar slorber commented on June 29, 2024

@rauchg in my example, the vendor.js of the 2nd deployment has been rebuilt (so I guess it has different mtime), but content is exactly the same as before and I want a 304 instead of a cache miss. Is it possible with now-serve, or would it be possible to make it an option?

from serve.

slorber avatar slorber commented on June 29, 2024

according to my test it seems it's actually working like I want. The modified time of a file is not updated if the content is exactly the same as before as far as I see

Edit: no, not working

from serve.

slorber avatar slorber commented on June 29, 2024

Opened another issue because 304 does not work for me: #40

from serve.

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.