Problem deleting / (root) cache entry

Discussion in 'LiteSpeed Cache' started by empowering, Aug 14, 2013.

  1. empowering

    empowering New Member

    Hi I'm trying to delete the home page (/) cache entry on this site (http://investorjunkie.com) and get the error listed here:


    405 Method Not Allowed

    No idea why because all sub pages work fine. I don't see any logic in my config files that would cause this issue.
  2. NiteWave

    NiteWave Administrator

    do you use /usr/local/lsws/admin/misc/purge_cache_byurl.php to delete the cache?
  3. empowering

    empowering New Member

    Yes that is what we are using.
  4. mistwang

    mistwang LiteSpeed Staff

    It probably related to the way how cache is enabled for "/" URL.
    For some reason, cache was not enabled for that page with PURGE request.
    Like in a situation that rewrite rule enable cache only when request method is "GET".
  5. empowering

    empowering New Member

    How do I figure out what the real URL is then? Is there a way to get a list of cached entries in the system? If the request works via "/" and states it is cached why doesn't then PURGE work?
  6. empowering

    empowering New Member

    Status: HTTP/1.1 200 OK
    Date: Thu, 15 Aug 2013 18:52:33 GMT
    Server: LiteSpeed
    Connection: close
    Transfer-Encoding: chunked
    Vary: User-Agent
    X-LiteSpeed-Cache: hit
    X-Powered-By: PHP/5.3.25
    X-Pingback: http://investorjunkie.com/xmlrpc.php
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Content-Type: text/html; charset=UTF-8
    X-W3TC-Minify: On

    So if a HTTP request works this way via the URI, why doesn't PURGE/REFRESH commands work the same?? This sounds like a bug to me.
    Last edited: Aug 15, 2013
  7. empowering

    empowering New Member

    here's the cached file

    Here's the file in your cache folder that matches to the home page.

    http://investorjunkie.com/tmp/edf34916a303feba.txt

    I couldn't attach this file as the limit to your forum is only 16k. The file is 56k in size.

    Please tell me why it's not matching?
  8. NiteWave

    NiteWave Administrator

    the cached file don't look helpful --- but great you can dig it out

    please paste the rewrite rules which lead to cache "/"
    (can omit rules to cache other URLs)
  9. empowering

    empowering New Member

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Other items are in the .htaccess file for W3TC.
  10. NiteWave

    NiteWave Administrator

    no cache enable flag like
    [E=Cacahe-Control:mag-age=60]
    in reriterules and use W3TC at the same time.

    how did you enable lsws cache ?
  11. empowering

    empowering New Member

    Where would that go?
  12. mistwang

    mistwang LiteSpeed Staff

    It does not matter if you do not use it.
    Just let us know how you enabled page cache for that site?

    From LSWS console cache tab? content level cache configuration? Apache directive?

    So, we can try to reproduce this issue and come up with a solution.
  13. empowering

    empowering New Member


    Cache Storage Settings
    Storage Path /usr/local/lsws/cache
    Max Object Size 128000

    Cache Policy
    Enable Cache Yes
    Cache Expire Time (seconds) 86400
    Cache Stale Age (seconds) Not Set
    Cache Request with Query String No
    Cache Request with Cookie Yes
    Cache Response with Cookie Yes
    Ignore Request Cache-Control Yes
    Ignore Response Cache-Control Yes
    Enable Private Cache No
    Private Cache Expire Time (seconds) Not Set

    Do-Not-Cache URL
    wp-admin
    wp-login.php
    feed

    Do-Not-Cache Domains
    Not Set

    running latest litespeed: 4.2.4
  14. NiteWave

    NiteWave Administrator

    the settings looks ok. can you PM the server's access so that I can do more tests on the server directly.
  15. empowering

    empowering New Member

    I sent you a private message. I need info from you. Though I don't see the message in my private outgoing emails.
  16. mistwang

    mistwang LiteSpeed Staff

    The purge request must be sent to the IP that the vhost bound to, by default purge_cache_byrul.php uses 127.0.0.1, but the request cannot reach the vhost unless it also bound to 127.0.0.1 IP. Explicitly set the IP in the purge request works.
  17. empowering

    empowering New Member

    Then why do other URLs work then? How can it work via 127.0.0.1 then since I need it to work via automated methods that don't add this.
  18. mistwang

    mistwang LiteSpeed Staff

    More investigation found that other URL works is due to a flaw in LSWS handling redirect.
    when 127.0.0.1 is used, it goes to the Apache default vhost at /var/www/html, the URL does not exist, causes a redirect to /404.shtml, when redirect performed, LSWS uses the "Host" header to locate the vhost and found the cached URL. then purged.

    For "/" URL, it does not perform the /404.shtml redirect.

    To make it work reliably, add the IP to purge_cache_byurl.php parameter, it works for all URL.

Share This Page