Skip to content

Openlitespeed Server Downloads Pages as Files #2409

Description

@thekendog

Describe the bug
I'm using the plugin on an Openlitespeed server. When enabled, at random times when I go to a page as an anonymous user the browser downloads it as a file (called download). It is not consistent and I can't intentionally replicate it. When I see the issue and then deactivate the plugin I do not get this issue. This is not the first site, nor the first OLS server I've seen this behavior on.

To Reproduce
Steps to reproduce the behavior:

  1. Install WP Rocket.
  2. Go to website in incognito.
  3. Pages randomly download as a file.

Expected behavior
Page loads as normal

Activity

  1. GeekPress commented on Mar 27, 2020

    @GeekPress
    Contributor

    Hi @thekendog 🤚

    We weren't able to reproduce the issue. May I kindly ask you a screencast (video) of the problem?
    Or if you still have the issue, could you please open a ticket support (https://wp-rocket.me/support/) and provide your WordPress and FTP access.

    Thanks

  2. thekendog commented on Mar 27, 2020

    @thekendog
    Author

    So I figured out the issue and it's some kind of error in my WP Rocket import file I believe. I have two sites both on OLS. One is working fine and the other isn't. Both are running 3.5.1. I looked in .htaccess. The one that wasn't working and was downloading had this in it.

    <IfModule mod_mime.c> AddType text/html .html_gzip AddEncoding gzip .html_gzip </IfModule> <IfModule mod_setenvif.c> SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} on [OR] RewriteCond %{SERVER_PORT} ^443$ [OR] RewriteCond %{HTTP:X-Forwarded-Proto} https RewriteRule .* - [E=WPR_SSL:-https] RewriteCond %{HTTP:Accept-Encoding} gzip RewriteRule .* - [E=WPR_ENC:_gzip] RewriteCond %{REQUEST_METHOD} GET RewriteCond %{QUERY_STRING} ="" RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC] RewriteCond %{REQUEST_URI} !^(/(.+/)?feed/?|/(?:.+/)?embed/|/(index\.php/)?wp\-json(/.*|$))$ [NC] RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC] RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" -f RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" [L] </IfModule>

    I removed those lines.

    EDIT: No clue why those rewrites were being added. Removing them works though.

  3. added
    can't reproduceIssues that can't be reproduced
    communityIssues created by someone outside of our team
    and removed on May 15, 2020
  4. GeekPress commented on May 15, 2020

    @GeekPress
    Contributor

    @thekendog Sorry for the delay.

    These rewrite rules are added to speed up the process to deliver a caching page.

    May I kindly ask you to open a ticket support? Then one of our support engineer will be able to investigate directly on your website the problem.

    Thanks

  5. webtrainingwheels commented on Jan 8, 2021

    @webtrainingwheels

    @GeekPress please can you re-open this - we continue to have tickets about it

  6. DahmaniAdame commented on Jan 9, 2021

    @DahmaniAdame
    Contributor

    Related ticket - https://secure.helpscout.net/conversation/1386879528/228665/
    OLS sending application/octet-stream header for HTML pages when WP Rocket is activated.
    The htaccess file wasn't corrupt after enabling WP Rocket.​
    Disabling our htaccess rules didn't fix the issue.
    Updating from 3.8.0.1 to 3.8.2 fixed the issue.
    Issue still there.

  7. DahmaniAdame commented on Jan 20, 2021

    @DahmaniAdame
    Contributor
  8. jorgemartine00 commented on Jan 21, 2021

    @jorgemartine00
    Contributor
  9. 27 remaining items

  10. DahmaniAdame commented on Sep 14, 2022

    @DahmaniAdame
    Contributor
  11. DahmaniAdame commented on Sep 14, 2022

    @DahmaniAdame
    Contributor
  12. sergio-gn commented on Nov 15, 2023

    @sergio-gn

    Facing same problem, using OpenLiteSpeed on AAPanel with WP Rocket.

    Removing below line added by WP Rocket in .htaccess fixed the problem but probably disabled serving gzip - RewriteRule .* - [E=WPR_ENC:_gzip]

    Any fix for this ?

    UPDATE FOUND SOLUTION: Seems to have found the issue & its solution (although don't know the logic but applied some common sense). Solution - In .htaccess file of your website in rules added by WP Rocket change "RewriteRule .* - [E=WPR_ENC:_gzip]" to "RewriteRule .* - [E=WPR_ENC:-gzip]" Solution was inspired by another similar line which was 2 lines before above line which was using "-" instead of "_" (line was "RewriteRule .* - [E=WPR_SSL:-https]") so tried it and it worked, cache & gzip both working now without DOWNLOAD problem.

    Would like some comment/feedback from WP Rocket about this change/solution.

    I removed the gzip line and the website is working again.
    Same environment as described before: LiteSpeed and CyperPanel.
    To prevent the htaccess from happening again I used the nogzip sent by @webtrainingwheels.

    Just a suggestion for the developers here:
    If a lot of users keep having problems and need to rely on helpers written as plugins, why not implement a new tab on the wp-rocket plugin named 'Helpers' with checkboxes for each problem, for example:

    • - remove all wp rocket rules htaccess
    • - remove gzip
    • - remove trailing-slash
    • - etc etc

    This way, it would be easier for nontechnical users to troubleshoot the problems and fix the problems.
    image

  13. Samsiani commented on Dec 29, 2023

    @Samsiani

    "RewriteRule .* - [E=WPR_ENC:_gzip]” to “RewriteRule .* - [E=WPR_ENC:-gzip]" in my .htaccsess fixed this

  14. BorisBelica commented on Mar 10, 2024

    @BorisBelica

    WP Rocket Version 3.15.9 on OpenLiteSpeed server. Same error - downloading site.

    "RewriteRule .* - [E=WPR_ENC:_gzip]”
    to
    “RewriteRule .* - [E=WPR_ENC:-gzip]"

    Do not fixed error.

  15. tonnick commented on Oct 31, 2024

    @tonnick

    me neither, this does not work. I tried to disable cache module on litespeed but no luck. issue is coming back after a while

  16. added
    severity: moderateFeature isn't working as expected but has work around to get same value
    3rd party compatibilityIssues related to 3rd party compatibility like theme, plugin or hosting
    and removed
    severity: moderateFeature isn't working as expected but has work around to get same value
    3rd party compatibilityIssues related to 3rd party compatibility like theme, plugin or hosting
    on Nov 27, 2024
  17. added
    priority: mediumIssues which are important, but no one will go out of business.
    and removed
    priority: highIssues which should be resolved as quickly as possible
    on Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    can't reproduceIssues that can't be reproducedcommunityIssues created by someone outside of our teampriority: mediumIssues which are important, but no one will go out of business.severity: moderateFeature isn't working as expected but has work around to get same valuetype: bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions