365werk / etagconditionals Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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:
etagconditionals/src/Middleware/IfNoneMatch.php
Lines 33 to 37 in aec728d
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/
This package can be easily updated to support Laravel 9.
PR opened: #17
Hi, would you be able to publish this version (1.4.1) #18 on Packagist?
According to the rfc If-match allows for a list of Etags, of which any one of them can be they correct Etag for the request.
https://datatracker.ietf.org/doc/html/rfc2616#section-14.24
Also apparently '*' is the wildcard symbol and should be treated special .
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.