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

304 Not Modified Response

Discussion in 'XenForo Development Discussions' started by Daniel Hood, Jul 7, 2013.

  1. Daniel Hood

    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.
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

  3. Daniel Hood

    Daniel Hood Well-Known Member

    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.
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
  5. Daniel Hood

    Daniel Hood Well-Known Member

    I would assume it occurs after the header. It's part of an action in a controllerPublic file.
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

  7. Daniel Hood

    Daniel Hood Well-Known Member

    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?
     
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm not sure what you are asking. Caching / your server may be returning a 304 Not Modified.
     
  9. Daniel Hood

    Daniel Hood Well-Known Member

    Probably is caching it, thanks. Do you know of a way to have certain pages not be cached?
     
  10. Jeremy

    Jeremy XenForo Moderator Staff Member

    I believe that's a setting on your server; and I'm not the best sys admin, so unfortunately, no.
     
  11. Daniel Hood

    Daniel Hood Well-Known Member

    Oh ok. I thought it was a xenforo thing, thanks.
     

Share This Page