• Resolved MatthiasWelz

    (@matthiaswelz)


    Hi,

    I have some issues running Wordfence on a WordPress instance hosted by Bluehost (which is also using Cloudflare). All observations below are done using Chrome and IE in private browsing mode.

    After enabling the Falcon Engine, the website gets much faster (which is very nice!). All sites load fine and the dashboard shows that the cache gets filled.

    However, after some time (I don’t really know what exactly triggers this), the site breaks (only displaying gibberish). After further analysis, the Falcon Engine seems to compress web pages twice. This page for example, is delivered this way (saved using “Save Link As”). When looking into wfcache directory, the _wfcache.html and _wfcache.html_gzip files both seem to contain compressed content; when comparing the page sent to the browser to the HTML file, they are almost identical.

    Clearing the Falcon Engine cache temporarily fixes the issue, but only for a short time.

    I have uploaded my htaccess file and the backup created by Wordfence.

    Any ideas what’s going on?
    Let me know if you need any further input from me.

    Thank you!
    Matthias

    https://wordpress.org/plugins/wordfence/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Matthias,

    I’ve asked our dev team to weigh in here.

    tim

    Plugin Author Wordfence Security

    (@mmaunder)

    Hi Matthias,

    Thanks very much for the detailed report. Tim forwarded this to me and I’ve looked at the samples you’ve posted and done some investigation on our own server.

    I think something else is compressing your page output and it’s doing it at the PHP level BEFORE falcon receives the data and caches it.

    So can you please post a list of the plugins you’re running and I’ll examine the list and try to reproduce this in our lab.

    Thanks again for the helpful report.

    Regards,

    Mark.

    Thread Starter MatthiasWelz

    (@matthiaswelz)

    Thank you for looking into the issue!

    I think something else is compressing your page output and it’s doing it at the PHP level BEFORE falcon receives the data and caches it.

    After looking further into this, this seems to be caused by Bluehost: http://webmasters.stackexchange.com/a/59280

    I tried to disable GZIP as shown here http://www.bluehostforum.com/showthread.php?18996-Turning-off-Gzip (note the “dont-vary” which is not added by Wordfence) and enabled the Falcon Engine again.
    However, after some time, some pages started becoming corrupted again (while other pages appear in the cache correctly)…

    Is it somehow possible to disable GZIP for Wordfence? Or allow Wordfence to uncompress the data?

    Plugin Author Wordfence Security

    (@mmaunder)

    Hi Matthias,

    Those articles are accurately describing the way GZIP normally works. Normally what happens is that PHP sends the output to apache which compresses it using mod_deflate and sends it to the browser.

    This varies somewhat depending on your configuration. For example, Nginx might be sitting in front of apache and actually do the compression. But in general PHP executes, sends the output and then the web server does the compression because having a C module do compression is way faster than doing it via PHP code.

    However Wordfence grabs your content and caches it BEFORE any web server can compress it. At least this is what normally happens.

    In your case it seems we’re grabbing content that is already compressed. This is really weird because it suggests that your content is is being compressed by PHP. I do recall seeing some compression code in WordPress core, but for now I don’t remember what triggers that. I do see a bug that was filed where users were asking for the feature, but it wasn’t implemented:

    https://core.trac.wordpress.org/ticket/10365

    However I’ve looked through the WP core code and there is gzip compression code in there. So can you please email me your wp-config.php file and remove andy database usernames and passwords before you do. My email is mark at wordfence dot com. I want to try and determine what is triggering this compression.

    Also please reference this thread in the email so I know what you’re referring to.

    Thanks.

    Mark

    Thread Starter MatthiasWelz

    (@matthiaswelz)

    Hi,

    sorry for the delay in my response.

    The wp-config.php contains nothing unusual (database settings, authentification / security setup, debug mode is disabled):

    define('DB_NAME', '[redacted]');
    define('DB_USER', '[redacted]');
    define('DB_PASSWORD', '[redacted]');
    define('DB_HOST', '[redacted]');
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    define('AUTH_KEY', '[redacted]');
    /* ... */
    
    $table_prefix = 'wp_pixx_';
    define('WP_DEBUG', false);
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    require_once(ABSPATH . 'wp-settings.php');
    
    /**
     * Include tweaks requested by hosting providers.  You can safely
     * remove either the file or comment out the lines below to get
     * to a vanilla state.
     */
    if (file_exists(ABSPATH . 'hosting_provider_filters.php')) {
    	include('hosting_provider_filters.php');
    }

    The referenced “hosting_provider_filters.php” contains code to disable xmlrpc-pingback.

    During the last week, I tried enabling the Falcon engine again with my attempted fix in place (adding SetEnv no-gzip dont-vary to the htaccess file).

    So far, it’s working without any issues. Maybe there had been some caching issues which played into this…

    Again (for people experiencing a similar behavior), my .htaccess file looks like this:

    #WFCACHECODE - Do not remove this line. Disable Web Caching in Wordfence to remove this data.
    #...
    #Do not remove this line. Disable Web caching in Wordfence to remove this data - WFCACHECODE
    
    RewriteEngine on
    # ... (Domain rewrites)
    
    # THE LINE I ADDED:
    SetEnv no-gzip dont-vary
    
    # Use PHP5.4 as default
    AddHandler application/x-httpd-php54 .php
    
    # BEGIN WordPress
    #...
    # END WordPress
    
    # ... (MIME-Types)
    
    # Start CloudFlare:journeyofcode.com rewrite. Do not Edit
    # ...
    # End CloudFlare rewrite.

    I don’t know the exact difference between my addition and the lines added by Wordfence:

    SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
    SetEnvIfNoCase Request_URI \.xml_gzip$ no-gzip

    So far, it seems to do the trick, however. I’ll update here if issues start appearing again.

    Cool.

    Let me know how it is going in a week. I want to add this to internal documentation for a workaround if its still good then.

    Thanks!

    tim

    Bob

    (@boblindner)

    I have experienced this exact situation on a few of my sites with Basic Caching (not Falcon). I’ve been trying to figure out what it is for quite a few weeks now. I put a keyword monitor on a few sites so I would be notifieid when it happened and this weekened it happened on a site just after I got an email from my http://infinitewp.com/ saying everything was up-to-date. I wonder if something in infinitewp is causing weird output to get cached?

    Just adding a piece to the puzzle.
    Bob

    p.s. – I’m not on Bluehost.

    @bob Check your theme, any other caching plugins, and your hosting provider for any mention of compression or gzip. Some themes add it as an option to speed up the site, as do hosting providers.

    tim

    I just had this happen as well. Fixed by clearing /wp-content/wfcache/. I am the hosting provider (standard cPanel config, no extra compression going on). I made the theme myself (using Artisteer) and have no other caching plugins installed. Watching this thread to see if there are any other ideas or solutions offered.

    – Scott

    Plugin Author WFMattR

    (@wfmattr)

    I’m have not used themes generated by Artisteer before, but they may include code in the theme files that causes compression to happen twice. There might be an option to turn it off in the theme’s options. If not, you could switch to Wordfence’s “basic caching” to prevent the conflict for now.

    If you could post a copy of your .htaccess file, we can take a look. This might be a different problem from above, and this thread was already marked as resolved, so if you could create a new post, that would be best. If the .htaccess file is long, you can use Pastebin and include a link in your post.

    I think I have narrowed this down:

    When I browse to the website, all I see is a whitepage, with a long line of garbage characters on the screen, starting with “YToxOntzOjc6InN1Y…”

    I went into /wp-content/wfcache/(domain name)/
    There are two files in this directory:
    ~~~~_wfcache.html
    ~~~~_wfcache.html_gzip

    I opened up ~~~~_wfcache.html and… well, look at this!

    <IWPHEADER>YToxOntzOjc6InN1Y… (snip)

    So, it’s the same string of garbage (as expected), but it’s prefaced with <IWPHEADER>.

    INDEED… I use InfiniteWP to manage all of my sites. This is a pretty popular script designed to give you a central location to see and manage all of your WP sites (you can push out and install plugins, keep everything updated, log in via admin, etc., etc.).

    Anyone else on this thread using InfiniteWP?

    – Scott

    Plugin Author WFMattR

    (@wfmattr)

    I haven’t used InfiniteWP myself, but the garbage characters you see are not from the compression problem in the original post above, but these details helped. These characters appear to be part of a PHP array (encoded), and not gzipped content.

    Since this topic was already marked as Resolved, though, can you create a new post with a title like “Falcon Cache and InfiniteWP”, and we can continue troubleshooting there?

    (In the meantime, you can try switching to Wordfence’s basic cache, and see if the same issue still occurs — it probably will — and mention the results in your new post.)

    Thanks, Matt. Problem happens no matter if I am using Basic Cache or Falcon Engine. I have created a new post and will move to that one going forward:

    https://wordpress.org/support/topic/falcon-cache-and-infinitewp?replies=1

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Issues with Falcon Engine and GZip (?)’ is closed to new replies.