Litespeed cache conflicting with the AMP

Discussion in 'LiteSpeed Cache Plugin For WordPress' started by Émerson Felinto, Jan 27, 2018.

  1. Émerson Felinto

    Émerson Felinto Well-Known Member

    Litespeed is conflicting with the AMP. I configured the cache plugin correctly and did not check the "activate mobile cache" option (worst of all is that when I activate the Litepeed plugin it returns an error, attached image).

    When accessing the site via Desktop, the AMP page that was configured using this plugin appears:
    When I clean the cache of Litespeed the page works normally, but soon after the AMP page (which should only display for mobile devices) appears in the Desktop version of the site.

    Attached Files:

  2. qtwrk

    qtwrk Member


    please try add this into htaccess

    ### marker MOBILE start ###
    RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
    RewriteRule .* - [E=Cache-Control:vary=ismobile]
    ### marker MOBILE end ###
    Last edited by a moderator: Jan 30, 2018
  3. Émerson Felinto

    Émerson Felinto Well-Known Member

    Last edited by a moderator: Feb 2, 2018
  4. Tishu

    Tishu Well-Known Member

    Did you try to put in the both places (LS settings and htaccess). Put that in the LS settings for mobile:

    Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi

    Save and clear cache after that.
    Émerson Felinto likes this.
  5. Émerson Felinto

    Émerson Felinto Well-Known Member

    I'm not sure if it worked, since I had to load the page more than once the errors disappeared. The error only appeared on activation. I'll wait a little longer and then post the feedback here.
    In any case developers should rethink the way this feature is designed. If I managed the hosting I had problems activating this, imagine my users!
    Thank you for your time and attention.
  6. lclarke

    lclarke Administrator Staff Member

    Thank you for your feedback.

    Our wiki explains every LSCWP error message. The explanation for the one you received is here.
    Essentially, what it means is that the Cache Mobile and List of Mobile User Agents settings are partners. If the former is enabled, then the latter must be populated. The step of editing .htaccess manually was actually not necessary. You could have simply entered the mobile agents into the setting, and LSCache would have updated .htaccess for you.

    So, while it is actually simple enough for one of your users to do on their own, it is not well-explained in the interface. That's our bad. We'll look into making the requirements more clear in a future release.
  7. Émerson Felinto

    Émerson Felinto Well-Known Member

    Okay, but I believe you should take that into account and I do not believe it's as easy as you mentioned.
    1) Attached to this post I placed an image showing the option to activate the mobile cache and to edit the list of agents. Unfortunately I can not edit the list of mobile agents, even if I try to click simply will not. The first impression is that this is a problem with my browser, but I can edit the other fields normally! Only after clicking on "activate Cache mobile" (and consequently see the error) I can edit the list of "user-agents". Be honest, if you were in my shoes, would you really like to see a mistake when all you did was hit a friendly button to turn on the cache mobile?
    2) After I activate the mobile cache I can edit the list of user-agents. Perfect! Okay, not quite ... The list of user-agents that you passed me is a standard list and should meet my needs just like most. So why not already insert those rules there automatically and give the option to edit, if a more advanced user wants it?
    3) I'm not sure which plugin update exactly, but I see that you have simplified the Litespeed Cache plugin settings page in "Basic view" and "Advanced view". However, as you said, the "Cache mobile" and "List of Mobile User Agents" settings go together ... so why separate one or the other?

    I believe that this feedback will guide you better about how this option should work. In case of doubts, you can see a bit about how W3 Total Cache works, although it is a considerably more complex plugin than yours, it does much better in this mobile cache configuration issue. The Litespeed Cache plugin is very good and I'm really enjoying the performance it gets, however simply informing my clients that they need to edit a couple of lines in .htaccess is not an option. Thank you! =)

    Attached Files:

  8. lclarke

    lclarke Administrator Staff Member

    Thank you for the additional feedback! We have already taken steps to improve the description of those two fields in the next version, so that ought to help the situation.

    After reading your most recent post, I went through the process myself of enabling Cache Mobile and specifying the List of Mobile User Agents, and I have two observations:
    1. Most people won't get the error message you have gotten because the field defaults to the recommended string. I am not sure why yours was blank, but that's the reason why the error message popped up for you.
    2. You're right. It's quite awkward, if you want to enable Cache Mobile and also change the List of Mobile User Agents to something else. We may want to take another look at how those fields work together.
    One last thing. It's possible you misunderstood something I said earlier. You wrote:
    I was not actually suggesting that you do that. What I meant to say is that the LSCache plugin edits .htaccess for you and your users. They should never have to do it themselves. If they update Cache Mobile and/or List of Mobile User Agents, .htaccess is updated accordingly by LSCache behind-the-scenes.

    I hope this makes sense, but if not, please feel free to ask! And thanks again for your detailed feedback.
  9. lclarke

    lclarke Administrator Staff Member

    Oh! I just noticed what you meant with point #3!
    I didn't realize that had been done. You're absolutely right, they need to be kept together. That was probably an oversight. Thanks for pointing it out!
    Émerson Felinto likes this.
  10. Émerson Felinto

    Émerson Felinto Well-Known Member

    Thank you for considering my observations! =)

    If you find it relevant, please feel free to update this topic when the Litespeed plugin update is released, in this way I can test it again and I will pass the feedback to you ;-)
    lclarke likes this.
  11. lclarke

    lclarke Administrator Staff Member

    Just to let you know, the fix has been committed, and will be available with the next update (probably this week).
    Thanks for the feedback!

Share This Page