How to prevent "304 Not Modified" in nginx?
Asked Answered
R

3

14

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 Firefox is getting "304 Not Modified" header.

Is there a way to prevent it?

P.S:

I think I found it myself. Firefox shows '200 OK' all the time now.

Is this correct way?

I've added

if_modified_since off;
add_header Last-Modified "";
Reuven answered 4/10, 2011 at 22:32 Comment(0)
M
10

Sounds right to me.

If the agent (in this case Firefox) says 200 OK, it means the transfer happened.

Monah answered 4/10, 2011 at 22:49 Comment(0)
D
8

Another way is to use a location directive:

location ~ \.(html|css|js)(.*)$ {
    expires -1;
    add_header Cache-Control no-store;
}
Dank answered 2/1, 2018 at 2:53 Comment(0)
G
-16

Another way is doing ctrl + f5

Guadalupe answered 18/8, 2012 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.