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

CloudFare & Caching Issues?

Discussion in 'Server Configuration and Hosting' started by RSI, Apr 1, 2016.

  1. RSI

    RSI Active Member

    Hi,

    I did find one topic here, but I recently moved my site to a new server and hosting company which also offered CloudFare installation via the cPanel, but there were issues with it and it would not install and setup everything properly.

    To make a long story short I had to set it up via CloudFare directly and I was able to get everything working correctly.

    Here's what I have noticed. Sometimes when you log into xenforo and even to the ACP you have to refresh the page because it returns back to the login page again until you refresh it. You are logged in, but it will not show it until you refresh the page because everything is cached in the cloud server. The same thing sometimes happens when you log out and it still shows you are logged in when you are really not.

    Are there any specific xenforo files that pertain to logging in and logging out that I can exclude from being cached?

    I’m using the wildcards below in two page rules to cache everything in all directries, etc.

    http://mydomain.com/*

    http://*mydomain.com/

    My board is lightning fast now using CloudFare and the pages load so fast that it’s really scary.
    .
     
    Last edited: Apr 1, 2016
  2. Mike

    Mike XenForo Developer Staff Member

    Conversely, everything in XF is dynamic. You should generally whitelist the specific things you want to cache. I couldn't recommend caching anything generated by XF, except maybe for css.php. Other pages will vary based on whether someone is logged in.
     
  3. RoldanLT

    RoldanLT Well-Known Member

    You should not be doing this instead, specify each uri to force caching like this:
    upload_2016-4-1_17-14-28.png
     
  4. RSI

    RSI Active Member

    Excellent, thank you. Looks like you are doing it too and already figured it out.

    I'll try it and see what happens.
    .
     
  5. RSI

    RSI Active Member

    Hi,

    I fixed the login and logout issue, but I still have one last problem. Does anyone know how to create a CloudFare page rule or something that will stop it from messing up attachment uploading?

    What I have noticed is that once everything is fully cached and you go to upload an attachment to a post it comes up with the error dialog box with the red bar. However, if I refresh that page with my browser add-on that also clears the browser's cache the attachments will then upload.

    Anyway, something is getting cached on CloudFare and I need to know how to stop it. It happens when in the the main post editor page and the quick reply and the bottom of threads both. I thought it might be connected to the flash uploader, but I'm still not sure. The bar graph does reach 100% each time before the error pops up.

    I've tried bypassing the cache with rules like the below, but I'm not exactly sure how to do it and it's probably something else anyway, but I'm still guessing...

    *mydomain.com/forums/*/create-thread*
    .
     
  6. RSI

    RSI Active Member

    I figured out the issue with attachment uploading about 3 weeks ago and it was just one of my page rules being set to "Cache Everything". I went back and changed all of my rules to the "Standard" cache level which is now called the "Aggressive" cache level since they recently updated all of that. For whatever reason one of the page rules was messing up attachment uploads due to the Cache Everything" setting I had used.

    Anyway, does anyone know how to add the new "Server Push" code to the header?

    They say to use the below, but where does that go? Do I add it to the PAGE_CONTAINER template or maybe in the css.php file? If so how?
    Code:
    Link: </asset/to/push.js>; rel=preload;
    The information for it is here: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/

    Thanks...
    .
     
    Last edited: May 9, 2016

Share This Page