Giter VIP home page Giter VIP logo

etagconditionals's People

Contributors

asbiin avatar hergend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

etagconditionals's Issues

Handle "weak validators" – etags prepended with W/

Thanks for an excellent package, just what I needed, and super simple to use!
However, when I deployed to production where I have nginx configured to compress responses, I learned something new!

If a browser receives a compressed 200 response, it seems to internally prepend W/ to the etag string from the response headers, indicating a "weak validator". Then on subsequent requests that indicator is also sent to the server in the request header. It will look something like this: If-None-Match: W/"cce76..."

I think we can solve this by just stripping away any W/ from the request etags, just before checking in the array:

$noneMatch = $request->getETags();
if (in_array($etag, $noneMatch)) {
$response->setNotModified();
}

If you think this is the correct solution, I'm willing to do a PR!

Here's a short discussion for reference: https://stackoverflow.com/questions/51973120/where-does-the-w-in-an-etag-appear-from
...although they say nginx adds the indicator, but I'm pretty sure it's the browser that does it from testing with curl.

Example from my own production site (where I have werk365/etagconditionals installed): curl -I https://www.equaliteam.com/ will give you a clean etag, while inspecting the same url in a browser like Chrome you can see the W/

Laravel 9

This package can be easily updated to support Laravel 9.

PR opened: #17

Add support for Laravel 9 (illuminate/support version 9)

Hej,

are there any plans to add support for Laravel 9? I really like this package and it would be a pity if I had to search for another package as a replacement. If I try to update to Laravel 9 there is the following error from composer:

Problem 1
  - Root composer.json requires werk365/etagconditionals ^1.4 -> satisfiable by werk365/etagconditionals[1.4.0]. 
  - werk365/etagconditionals 1.4.0 requires illuminate/support ~7|~8 -> found illuminate/support[v7.0.0, ...,
    v7.30.6, v8.0.0, ..., v8.83.26] but these were not loaded, likely because it conflicts with another require.

laravel/sanctum and laravel/ui for example need at least illuminate/support in version 9.

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.