rrevi
rrevi

Reputation: 1051

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

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

Upvotes: 6

Views: 13542

Answers (4)

Rajashekhar
Rajashekhar

Reputation: 91

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>

Upvotes: 9

Leonid Vysochyn
Leonid Vysochyn

Reputation: 1264

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.

Upvotes: 3

Codo
Codo

Reputation: 79033

I'm not sure I fully understand your question. I assume you want the provide a normal HTTP answer if the client uses a correct URL, and a default page (with status 200) when the client uses a non-existing URL.

If this is the case, it can be achieved like that:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*+ /dummy.html

The first line is a condition that the URL doesn't macht an existing file on the web server. If that condidition holds, the second line is executed which serves a dummy page to the client.

Upvotes: -1

Matti Virkkunen
Matti Virkkunen

Reputation: 65166

Don't send it any cache-related headers (If-Modified-Since, If-None-Match and friends) when making the request. This informs the server that the client doesn't cache, and makes it always return data.

Upvotes: 0

Related Questions