Hi everyone,
I'm seeking help with a persistent issue regarding Drupal 11 CSS aggregation on my server setup. I hope someone might have encountered this or have some ideas.
My Environment:
- CMS: Drupal 11
- Control Panel: CyberPanel 2.3
- Web Server: OpenLiteSpeed (OLS)
- OS: AlmaLinux 8
- Cloudflare: Used for DNS management ONLY (Proxy feature is disabled - Grey Cloud).
The Problem:
When I enable Drupal's "Aggregate CSS files" setting (css.preprocess = 1 at /admin/config/development/performance), the website's styling breaks (e.g., menus malfunction, layout issues occur).
Upon investigation, I discovered that while most aggregated CSS files are correctly generated in the web/sites/default/files/css/ directory as plain text *.css files, one specific aggregated CSS file is consistently saved with a .css extension but contains binary Gzip data. Viewing this particular file's content shows unreadable characters (e.g., \n6áÈÙ”...).
The HTML source code correctly links to the .css file (e.g., <link href="/sites/default/files/css/css_some_hash.css">), not a .css.gz file. It appears the browser receives this binary Gzip content but expects plain text/css, leading to parsing failure and broken rendering.
Disabling Drupal's CSS aggregation (css.preprocess = 0) resolves the display issue entirely, but this negatively impacts page load performance, which I would prefer to avoid.
Troubleshooting Steps Already Performed:
I have tried extensively to resolve this, including:
- File Permissions: Verified and set correct write permissions for the web server/PHP user on the
web/sites/default/files/directory and itscss/jssubdirectories. - vHost Configuration: Explicitly set
enableGzip 0andenableBr 0in the vHost configuration file for my domain (eg.one). - LSWS WebAdmin Console (Port :7080):
- Confirmed
Enable GZIP Compression: NoandEnable Brotli Compression: NounderVirtual Hosts -> eg.one -> Generaltab. - Checked inside
Virtual Hosts -> eg.one -> Contexttab, specifically for the/context (Type: Static), and ensured any Gzip/Brotli/Compression settings there were also disabled. - Checked server-level Gzip/Brotli settings in
Server Configuration -> Tuning -> Gzip/Brotli Compression(tested disabling server-level compression, no change, reverted).
- Confirmed
.htaccess: Temporarily commented out the standard Drupal.htaccessblock related to serving pre-compressed.gzfiles (<IfModule mod_headers.c>...). This had no effect, so the change was reverted.- LSWS Cache Module: Temporarily commented out the
module cache { ... }block in the vHost configuration. This also had no effect, so the change was reverted. - Cloudflare: Confirmed Cloudflare Proxy is disabled (DNS Only / Grey Cloud).
My Question:
Despite explicitly disabling Gzip/Brotli compression at multiple levels (vHost, Context, potentially Server), OpenLiteSpeed/CyberPanel still seems to incorrectly compress just one specific aggregated CSS file on disk, saving it with binary data under a .css extension.
- Does anyone know why this might be happening, especially affecting only one file?
- Are there other less obvious OpenLiteSpeed or CyberPanel settings I should investigate that could cause this behavior? * Could this be a known bug related to specific versions or configurations?
Any advice or direction would be highly appreciated!
Thank you,
Trung