304 Not Modified Response

Daniel Hood

Well-known member
I have a page that displays json output, it's supposed to sleep if there's no content and wait for there to be content. Sometimes though it returns right away with no content and the header information is a 304 "Not Modified" response. Any ideas why? I noticed doing a hard refresh (f5) fixes it, only temporarily though.
 
Thanks. I actually did read that but I'm not on lightspeed and I feel like it's still going to kill my script. The issue is that whatever causes it to return the 304 header is also causing my sleep function to not work. Whenever it doesn't return that header, it sleeps just fine.
 
Is your sleep function before or after the header? It may occur on other systems, but the above fix shouldn't change anything in your script except explicitly return "application/json". A 304 Not Modified is still returned.
 
Yeah I figured. So any idea what causes it to be set as 304? I mean I know that one line but what makes that one line be called?
 
I'm not sure what you are asking. Caching / your server may be returning a 304 Not Modified.
 
I believe that's a setting on your server; and I'm not the best sys admin, so unfortunately, no.
 
Back
Top Bottom