• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

304 Not Modified Response

Daniel Hood

Well-known member
#1
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.
 

Daniel Hood

Well-known member
#3
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.
 

Jeremy

Well-known member
#4
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.
 

Daniel Hood

Well-known member
#7
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?