Questions tagged [http-status-code-304]

The HTTP response status code 304 Not Modified

Indicates the resource has not been modified since last requested. Typically, the HTTP client provides a header like the If-Modified-Since header to provide a time against which to compare. Using this saves bandwidth and reprocessing on both the server and client, as only the header data must be sent and received in comparison to the entirety of the page being re-processed by the server, then sent again using more bandwidth of the server and client.

Related tags

See also RFC2616.

181 questions
194
votes
2 answers

How does "304 Not Modified" work exactly?

How are "304 Not Modified" responses generated? How does a browser determine whether the response to an HTTP request is 304? Is it set by the browser or sent from the server? If sent by the server, how does the server know the data available in…
VenomVendor
  • 15,064
  • 13
  • 65
  • 96
124
votes
7 answers

NodeJS/express: Cache and 304 status code

When I reload a website made with express, I get a blank page with Safari (not with Chrome) because the NodeJS server sends me a 304 status code. How to solve this? Of course, this could also be just a problem of Safari, but actually it works on all…
h345k34cr
  • 3,310
  • 5
  • 21
  • 28
54
votes
5 answers

Why am I getting "(304) Not Modified" error on some links when using HttpWebRequest?

Any ideas why on some links that I try to access using HttpWebRequest I am getting "The remote server returned an error: (304) Not Modified." in the code? The code I'm using is from Jeff's post here (the page seems to have disappeared, see an…
Greg
  • 34,042
  • 79
  • 253
  • 454
47
votes
5 answers

How to check if jQuery.ajax() request header Status is "304 Not Modified"?

How to check if jQuery.ajax() request header Status is "304 Not Modified"? jqXHR.status usually returns 200, even when requested header is "304 Not Modified". ifModified:true does not help a lot because it breaks XHR data request.
Binyamin
  • 7,493
  • 10
  • 60
  • 82
31
votes
5 answers

HttpWebRequest.GetResponse throws WebException on HTTP 304

When a web server responds to HttpWebRequest.GetResponse() with HTTP 304 (Not Modified), GetResponse() thows a WebException, which is so very weird to me. Is this by design or am I missing something obvious here?
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
28
votes
3 answers

jQuery AJAX producing 304 responses when it shouldn't

This really has me scratching my head. Namely because it only happens in IE, not Firefox, and I was under the impression that jQuery was effectively browser neutral. I've been cracking at this thing for the past few hours and have nailed down, at…
guildsbounty
  • 3,326
  • 3
  • 22
  • 34
28
votes
4 answers

Does requests.codes.ok include a 304?

I have a program which uses the requests module to send a get request which (correctly) responds with a 304 "Not Modified". After making the request, I check to make sure response.status_code == requests.codes.ok, but this check fails. Does requests…
stett
  • 1,351
  • 1
  • 11
  • 24
28
votes
3 answers

304 Not Modified with 200 (from cache)

I'm trying to understand what exactly is the difference between "status 304 not modified" and "200 (from cache)" I'm getting 304 on javascript files that I changed last. Why does this happen? Thanks for the assistance.
Boltosaurus
  • 2,138
  • 3
  • 21
  • 33
24
votes
2 answers

Using HTTP 304 in response to POST

I have a REST API that allows modification of resources using HTTP POST. It's possible that a client may submit a POST request that results in no modification of the resource. I'm thinking about using the 304 response generally used for conditional…
IronDuck
  • 371
  • 1
  • 2
  • 6
23
votes
7 answers

How can I get control of Google App Engine caching behavior in WebKit (etags gone crazy)?

Situation: running a Google App Engine site with my static content's default_expiration set to "14d" Problem: in Chrome and Safari, visiting a URL (not reloading, just putting the cursor in the address bar and hitting Enter), causes a ton of…
kamens
  • 11,910
  • 6
  • 45
  • 46
20
votes
2 answers

What headers do I want to send together with a 304 response?

When I send a 304 response. How will the browser interpret other headers which I send together with the 304? E.g. header("HTTP/1.1 304 Not Modified"); header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"); Will this make sure…
Willem
  • 1,094
  • 1
  • 12
  • 23
20
votes
3 answers

ASP.NET MVC : how do I return 304 "Not Modified" status?

ASP.NET MVC 3.0, IIS 7, .NET 4 I have an action that returns data that seldom changes (almost static). Is there an easy way to: return 304 "Not Modified" from action; include "Last-Modified" time stamp in the response. I use return Content('my…
THX-1138
  • 21,316
  • 26
  • 96
  • 160
19
votes
4 answers

AFNetworking : How to know if response is using cache or not ? 304 or 200

I can't find any answer to my question, may be I miss something... When I ask for a url, I need to know if the response comes from the cache or from the net. Is the status code 304 or 200 ? (but AFNetworking always responde 200) With ASIHTTPRequest…
Vassily
  • 899
  • 2
  • 8
  • 19
17
votes
2 answers

Django - http code 304, how to workaround in the testserver?

I have a CSS code that generates http 304: [08/Nov/2011 15:22:07] "GET /site_media/logo1.gif HTTP/1.1" 304 0 How can I get a workaround using the Django test server? Any clues? Best Regards,
André
  • 24,706
  • 43
  • 121
  • 178
14
votes
3 answers

How to prevent "304 Not Modified" in nginx?

I'm trying to disable all the caches in nginx for testing purpose. I've set the following line add_header Cache-Control no-cache; I see that the page itself is not cached, but the images, css, and javascripts are. I suspect that this is because…
Moon
  • 22,195
  • 68
  • 188
  • 269
1
2 3
12 13