Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to have apache always return code 200 with data instead of 304?

Tags:

http

apache

I would like to have Apache HTTPD return response code 200 with data of resource request via a GET instead of returning response code 304 with no data. Any one have an idea how to do that?

Thanks in advance

like image 742
Rafael Avatar asked Sep 20 '10 14:09

Rafael


People also ask

Why do I GET 304 instead of 200?

The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition evaluated to false.

Why am I getting 304?

An HTTP 304 not modified status code means that the website you're requesting hasn't been updated since the last time you accessed it. Typically, your browser will save (or cache) web pages so it doesn't have to repeatedly download the same information.

What is status 304 Not Modified?

The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources. It is an implicit redirection to a cached resource.


2 Answers

remove the header, add the following into the httpd.conf file

<FilesMatch "\.(filetype1|filetype2)$">
    RequestHeader unset If-Modified-Since
    RequestHeader unset If-None-Match
</FilesMatch>
like image 198
Rajashekhar Avatar answered Nov 15 '22 04:11

Rajashekhar


Add the following directive to your apache config file

RequestHeader unset If-Modified-Since

This will ignore IF-Modified-Since header sent from client so you will get not 304 Not Modified response.

like image 44
Leonid Vysochyn Avatar answered Nov 15 '22 06:11

Leonid Vysochyn