Cloudflare Issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mr.kim
    Member
    • Oct 2009
    • 32
    • 4.2.x

    Cloudflare Issues

    What are the best practice settings and tweaks when using cloudflare. I set up cloudflare and My admin page is not working correctly. It's requiring multiple log on and when I go back to the site home page it logs me out.
    StudentFilmmakers Forums
    http://www.studentfilmmakers.com/forums
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 73976

    #2
    You should exclude the AdminCP from being cached with Cloudflare's (or any CDN) services.

    IN order to use Cloudflare caching on the front-end you need to set up the Proxy server information in your /core/includes/config.php.

    It is this code:
    Code:
    /* #### Reverse Proxy IP ####
    If your use a system where the main IP address passed to vBulletin is the address of a proxy server
    and the actual 'real' ip address is passed in another http header then you enter the details here */
    
    /* Enter your known proxy servers here. You can list multiple trusted IPs separated by a comma.
    You can also use the * wildcard (at the end of a definition only) or use the keyword 'all' to represent any ip address.*/
    //$config['Misc']['proxyiplist'] = '127.0.0.1, 192.168.*, all';
    
    /* If the real IP is passed in a http header variable other than HTTP_X_FORWARDED_FOR, then you can set the name here; */
    //$config['Misc']['proxyipheader'] = 'HTTP_X_FORWARDED_FOR';
    For Cloudflare you should probably set it like this:
    Code:
    $config['Misc']['proxyiplist'] = 'all';
    $config['Misc']['proxyipheader'] = 'HTTP_CF_CONNECTING_IP';
    Last edited by Wayne Luke; Thu 14 Feb '19, 8:53am.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • Wayne Luke
      vBulletin Technical Support Lead
      • Aug 2000
      • 73976

      #3
      You should also read these articles - https://support.cloudflare.com/hc/en...ions/200805497
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API

      Comment

      • glennrocksvb
        Former vBulletin Developer
        • Mar 2011
        • 4011
        • 5.7.X

        #4
        Useful links when using Cloudflare with vB. I did both on my own vB5 forum.



        https://vbmods.rocks/forum/vbulletin...​​

        Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

        Comment

        • glennrocksvb
          Former vBulletin Developer
          • Mar 2011
          • 4011
          • 5.7.X

          #5
          And like what Wayne said, I bypassed caching /admincp in the Page Rules. I also bypassed /ajax requests.

          Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

          Comment

          • Wayne Luke
            vBulletin Technical Support Lead
            • Aug 2000
            • 73976

            #6
            Originally posted by Glenn Vergara
            This change will be made to the default .htaccess file included with vBulletin 5.5.1.

            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment

            • Maltair
              Senior Member
              • Feb 2009
              • 575
              • 5.7.5

              #7

              Originally posted by Wayne Luke
              I really think Cloudflare is slowing down your site due to improper caching. It is trying to cache pages that aren't public and they won't load well due to this. In fact, I received several 504 errors while trying to look at the PM issue specifically from Cloudflare.
              So what exact settings do you recommend within Cloudflare then?

              Originally posted by Glenn Vergara
              And like what Wayne said, I bypassed caching /admincp in the Page Rules. I also bypassed /ajax requests.
              How do I bypass ajax requests? Will this solve the PM bottleneck Wayne describes?

              Comment

              • Wayne Luke
                vBulletin Technical Support Lead
                • Aug 2000
                • 73976

                #8
                Originally posted by MDawg


                So what exact settings do you recommend within Cloudflare then?



                How do I bypass ajax requests? Will this solve the PM bottleneck Wayne describes?
                You would have to try it in Cloudflare. AJAX calls go to /api/. We do not provide support for Cloudflare mainly because we have no access to their tools and it is server configuration, not software.
                Translations provided by Google.

                Wayne Luke
                The Rabid Badger - a vBulletin Cloud demonstration site.
                vBulletin 5 API

                Comment

                • Maltair
                  Senior Member
                  • Feb 2009
                  • 575
                  • 5.7.5

                  #9
                  Yes I know I have to do most of this in Cloudflare, so I am hoping Glenn will come in and suggest something as far as settings at the Cloudflare side.

                  But in the meantime, what are the exact suggested settings in .htaccess and /core/includes/config.php - this thread is over a year old so want to see what exactly should be done at the vbulletin side.

                  Comment

                  • Wayne Luke
                    vBulletin Technical Support Lead
                    • Aug 2000
                    • 73976

                    #10
                    There are no vBulletin settings in the .htaccess file. Technically, this isn't even a vBulletin file. That is, vBulletin never opens or reads this file via PHP. It is an Apache configuration file. We provide a basic default to help customers get up and running. Ideally, they would add this to their virtual host file for performance benefits but most don't have the capability to do that.

                    If you search your vBulletin 5.6.2 /core/includes/config.php file for the word cloudflare, you'll see two settings to allow for Proxy Forwarding and using the correct IP address of the end user. This will allow your IP Tracking to be more accurate. It will not affect page loads or caching services provided by Cloudflare. Proxy support is the sum total of Cloudflare support. It is only there because at one time they had a help page providing the same information. After we added it to the config.php, the help page on the Cloudflare site was removed (for whatever reason they have).
                    Translations provided by Google.

                    Wayne Luke
                    The Rabid Badger - a vBulletin Cloud demonstration site.
                    vBulletin 5 API

                    Comment

                    • Maltair
                      Senior Member
                      • Feb 2009
                      • 575
                      • 5.7.5

                      #11
                      I did find this.
                      Using Cloudflare with vBulletin forums

                      Also I am hoping Glenn will come in to add to this thread again.

                      I am just not exactly clear on how to write the rules to bypass the caching of the AdminCP and the ajax etc.

                      I have been experimenting with the Cache settings at the cloudflare controlpanel. Not done yet. However, I also flat out Paused the cloudflare and this did not seem to make a difference one way or another. However, I am not sure how instantly this Pause takes effect. I paused it and then immediately tested PM loading speed at my vb5 forum, and did not notice any difference, so I made Cloudflare active again.
                      Last edited by Maltair; Thu 2 Jul '20, 10:41am.

                      Comment

                      • OrganForum
                        Senior Member
                        • Feb 2013
                        • 131
                        • 5.7.X

                        #12
                        I've tried using Cloudflare and the caching seems to work well. Unfortunately, there's one problem that I've been unable to solve. When Cloudflare is enabled, unless a user signs in with Remember Me, they are logged out after a minute or two on my site. On Glenn Vergara 's VBMods.rock site, which is using Cloudflare I believe, I cannot log in at all unless I check Remember Me. I assume that the proxy is not passing the originating IP in the Forwarded-For and/or CF-Connecting-IP headers and that's messing up the session and the Remember Me cookie compensates for that by maintaining the credentials. In fact, I don't see these headers at all using the browser development tools when Cloudflare is active. if the proxy settings are enabled in config.php, does VBulletin strip these headers out before serving the page?
                        VB 5.7.2
                        PHP 7.4
                        MySQL 8.0.28

                        Comment

                        • glennrocksvb
                          Former vBulletin Developer
                          • Mar 2011
                          • 4011
                          • 5.7.X

                          #13
                          OrganForum, please check my response to your topic on my site at https://vbmods.rocks/forum/members-l...ut-remember-me

                          Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

                          Comment


                          • OrganForum
                            OrganForum commented
                            Editing a comment
                            Thanks, Glenn. No joy yet. Will continue our conversation on your site.
                        • Wayne Luke
                          vBulletin Technical Support Lead
                          • Aug 2000
                          • 73976

                          #14
                          Originally posted by OrganForum
                          I've tried using Cloudflare and the caching seems to work well. Unfortunately, there's one problem that I've been unable to solve. When Cloudflare is enabled, unless a user signs in with Remember Me, they are logged out after a minute or two on my site. On Glenn Vergara 's VBMods.rock site, which is using Cloudflare I believe, I cannot log in at all unless I check Remember Me. I assume that the proxy is not passing the originating IP in the Forwarded-For and/or CF-Connecting-IP headers and that's messing up the session and the Remember Me cookie compensates for that by maintaining the credentials. In fact, I don't see these headers at all using the browser development tools when Cloudflare is active. if the proxy settings are enabled in config.php, does VBulletin strip these headers out before serving the page?
                          You've uncommented lines 332 through 337 in your /core/includes/config.php file?

                          They should look like:
                          Code:
                          ​​//default configuration for Cloudflare proxy.
                          $config['Misc']['proxyiplist'] = '103.21.*, 103.22.*, 103.31.*, 104.16.*, 108.162.*, 131.0.*, ' . 
                          	'141.101.*, 162.158.*, 172.64.*, 173.245.*, 188.114.*, 190.93.*, 197.234.*, 198.41.*, ' . 
                          	'2400:cb00:*, 2405:b500:*, 2606:4700:*, 2803:f800:*, 2c0f:f248:*, 2a06:98c0:*';
                          
                          $config['Misc']['proxyipheader'] = 'HTTP_CF_CONNECTING_IP';
                          You can also try replacing everything for proxyiplist with all.

                          i.e.:

                          Code:
                          $config['Misc']['proxyiplist'] = 'all'
                          Translations provided by Google.

                          Wayne Luke
                          The Rabid Badger - a vBulletin Cloud demonstration site.
                          vBulletin 5 API

                          Comment


                          • OrganForum
                            OrganForum commented
                            Editing a comment
                            Thanks. Yep, done those things as well as fix that @glennrocksvb found and worked for him. In addition I've tried updating the IP addresses with the latest from the Cloudflare site. Still having the sign-in issue and am seeing Cloudflare IPs in the session table, Time for me to take a deep breath and systematically go through the configurations again, I guess.

                        Related Topics

                        Collapse

                        Working...