WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Issues with the server_name directory in /supercache/ (7 posts)

  1. Biranit
    Member
    Posted 1 year ago #

    Hi Donncha,

    I really need your help here please.

    I have three web servers on the same network. They are constantly synchronized, so no issues have arisen from this for the past year.

    I have two websites running on these servers - blogs.timesofisrael.com and http://www.timesofisrael.com. They are identical as far as the wp-config.php file goes, as far as plugins go, etc. They are also identical as far as their httpd.conf vhost goes.

    Yet despite this, if I look at /wp-content/cache/supercache/ this is what I get for one:

    [apache@xxxxxx supercache]$ ls -l
    total 352
    drwxr-xr-x 5401 apache toi 356352 May 16 20:20 blogs.timesofisrael.com
    [apache@xxxxxx supercache]$

    And this is what I get for the other:

    [apache@xxxxxx supercache]$ ls -l
    total 2340
    drwxr-xr-x     2 apache toi    4096 May 16 20:15 111.111.111.111
    drwxr-xr-x     5 apache toi    4096 May 16 20:14 aaa.timesofisrael.com
    -rw-------     1 apache toi  434512 May 16 20:09 index.html
    -rw-------     1 apache toi   65212 May 16 20:09 index.html.gz
    drwxr-xr-x 19600 apache toi 1871872 May 16 20:25 www.timesofisrael.com
    [apache@xxxxxx supercache]$

    (I masked the IP and stuff in the lines above)

    I made sure that the ServerName is correct and that UseCanonicalName is On. Yet despite this, it ignores the server_name in one and doesn't in the other.

    The multiple directories for http://www.timesofisrael.com is causing me problems - users don't always get served the correct page version, etc. I delete these directories but they come back.

    I tried editing .htaccess for http://www.timesofisrael.com, replacing /wp-content/cache/supercache/%{SERVER_NAME}/ with /wp-content/cache/supercache/www.timesofisrael.com/ -- but that made no difference at all.

    Could you please advise me what to do? I'm maxed out on ideas and it's a rather urgent issue for us.

    Thank you,

    Bira

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Biranit
    Member
    Posted 1 year ago #

    I think the problem is that you may be using HTTP_HOST instead of SERVER_NAME in some places. Is that possible?

  3. Biranit
    Member
    Posted 1 year ago #

    Donncha,

    This is my guess of what the problem is, and how to fix it:

    In wp-cache-base.php you have a line:

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );

    I think this should be:

    if ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) {
    	$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
    } else {
    	$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'SERVER_NAME' ] );
    }
  4. jondaley
    Member
    Posted 1 year ago #

    Yeah, I mentioned this to Donncha before. He fixed some of them, but not all of the places where HTTP_HOST is used.

    I get case-sensitive named directories too.

  5. Biranit
    Member
    Posted 1 year ago #

    Hi jondaley,

    Yes, I used to get case sensitive and spelling errors too :)

    Anyway, I commented out the line

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );

    And changed it to

    $WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'SERVER_NAME' ] );

    And that absolutely fixed my issue...

    Now I just hope Donncha includes this (or the above solution I gave him) in the next release, so I don't have to edit this file every time :)

    Thanks,

    Bira

  6. jondaley
    Member
    Posted 2 months ago #

    I've been getting lots of weird cached directories on one of my sites - it is the default site for this particular IP address, and apparently, it is some sort of weird spammer thing to try to pollute caches or something? They are sending their own HTTP_HOST in the request, and then supercache creates a directory with their hostname (or IP address).

    I'll try your fix and see how that works for me.

  7. jondaley
    Member
    Posted 2 months ago #

    Now looking at the code I see that your fix would not work in a multi-site installation, or at least in some cases within a multi-site installation, because there would be cache collisions among different blogs, and so the HTTP_HOST is needed in that case.

    But, for me, I haven't gotten the multi-site installations to work very well in wordpress anyway, so it looks like your fix is good.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.