Comments (6)
I had to flush my cache but yeah now it's a 200 (and now I know caching really is working)
from render.
Ah, seems like I need to return null
as the response body if the file is 0-length. I'll look into that now.
from render.
Fixed by bb39427, thanks!
from render.
I've been thinking about this some more
Seems like most web servers serve 0-byte files by responding with a 200 OK with a "content-length: 0". I can't speak for every web server but that's definitely how Apache does it, as well as whatever Github Pages and Cloudflare Pages are running.
Was it a conscious decision to use a 204 No Content for this or are you just getting a 204 from R2 and passing it along?
Would it make more sense to copy how most web servers behave and do it as a 200 OK / content-length: 0? With a 200 OK, you're able to actually browse to a 0-byte file and the browser will show a blank page (unless the server set the content type as application/octet-stream in which case it will treat it as a download), whereas with a 204 No Content, the browser will remain on the page it's on and it will basically seem like nothing happened (regardless of content-type).
another data point: wget will decline to write anything to disk if the server returns a 204 Not Found, whereas with a 200 OK content-length 0, it will write a 0-byte file. So if someone is using wget to spider a site with links to 0-byte files (but with potentially informative filenames), 204's will result in the site not being spidered properly as the 0-byte files won't make it onto disk.
from render.
I checked this some more and it seems like 200 is more appropriate. Also I forgot to send Content-Length it seems? I can't fix this now as I'll be busy for the next few days but if you want you can PR this, should be fairly straightforward. Sorry if it causes you any inconvenience.
from render.
I believe I've fixed this with c2f347b. Let me know if anything else breaks.
from render.
Related Issues (12)
- Configuring CORS (Access-Control-Allow-Origin) HOT 5
- Music playing CORS/Cache/worker error HOT 4
- Turn off cache? HOT 4
- Cache hit ignored for 304 response HOT 2
- Remove `range-parser` dependency HOT 2
- List items in bucket HOT 13
- Etag needs to be quoted? HOT 2
- how to upload HOT 2
- cache.put always fired HOT 2
- site showing errors always in the first requests to a file HOT 3
- "wrangler publish" fails, "Error: missing field `type`" HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from render.