http-status-code-304

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

匆匆过客 提交于 2019-12-20 17:38:28
问题 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 the browser will not send another conditional GET request (nor any request) until $offset time has "run out"? Also, what about other headers? Should I send headers like this together with the 304: header('Content-Type: text/html'); Do I have to send:

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

霸气de小男生 提交于 2019-12-18 03:54:45
问题 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 data'); for action result. Basically I want an easy way to do what is talked about in this article : http://weblogs.asp.net/jeff/archive/2009/07/01/304-your-images-from-a-database.aspx 回答1: (Very!) late answer but this question pops up near the top in

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 03:54:18
问题 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 data'); for action result. Basically I want an easy way to do what is talked about in this article : http://weblogs.asp.net/jeff/archive/2009/07/01/304-your-images-from-a-database.aspx 回答1: (Very!) late answer but this question pops up near the top in

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

走远了吗. 提交于 2019-12-17 15:44:24
问题 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 I used to check " didUseCachedResponse " from ASIHTTPRequest , this was perfect. 回答1: I think I found a solution to determine if response was returned from cache or not using AFNetworking 2.0. I found out that each time a new response is returned

NodeJS/express: Cache and 304 status code

こ雲淡風輕ζ 提交于 2019-12-17 08:04:23
问题 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 other websites fine, so it has to be a problem on my NodeJS server, too. To generate the pages, I'm using Jade with res.render . Update: It seems like this problem occurs because Safari sends 'cache-control': 'max-age=0' on reload. Update 2: I now

prevent Apache from serving pages with 304 status code

纵然是瞬间 提交于 2019-12-12 01:53:55
问题 I have a server, LAMP, set up and a CakePHP App. When I request a web page through any web browser, it always replies with a 304 status, serving old pages even after i have changed the page. It seems like the server keeps any previously accessed page in a cache and serves it back to anybody that request it afterwards. E.g: User "X" logs into this system and access the page "home" and logs out. When a different user "Y" logs into the system, he is going to see "X"'s "home" whereas he is

Using HTTP 304 in response to POST

限于喜欢 提交于 2019-12-08 14:45:15
问题 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 responses to indicate that the request had no effect. I haven't been able to find any examples of this being done, so I figured I'd ask here and see if anyone else is doing this or has an opinion about it. 回答1: After some consideration, I've

304 response does not set custom header for apache with mod_headers

安稳与你 提交于 2019-12-07 07:44:25
问题 <VirtualHost *:80> ServerAdmin webmaster@dev.dom.com DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" ServerName dev.dom.com ServerAlias dev.dom.com ErrorLog "logs/dev.dom.com-error.log" CustomLog "logs/dev.dom.com-access.log" common PassEnv CLUSTER Header always set X-Cluster "%{CLUSTER}e" </VirtualHost> Here is my configuration. I have an environment variable which tells me what cluster I am on, which is passed as a header in 'X-Cluster'. This returns fine on a

How to prevent HTTP 304 in Django test server

耗尽温柔 提交于 2019-12-07 04:59:06
问题 I have a couple of projects in Django and alternate between one and another every now and then. All of them have a /media/ path, which is served by django.views.static.serve , and they all have a /media/css/base.css file. The problem is, whenever I run one project, the requests to base.css return an HTTP 304 (not modified), probably because the timestamp hasn't changed. But when I run the other project, the same 304 is returned, making the browser use the file cached by the previous project

How to prevent HTTP 304 in Django test server

最后都变了- 提交于 2019-12-05 06:19:53
I have a couple of projects in Django and alternate between one and another every now and then. All of them have a /media/ path, which is served by django.views.static.serve , and they all have a /media/css/base.css file. The problem is, whenever I run one project, the requests to base.css return an HTTP 304 (not modified), probably because the timestamp hasn't changed. But when I run the other project, the same 304 is returned, making the browser use the file cached by the previous project (and therefore, using the wrong stylesheet). Just for the record, here are the middleware classes: