?
avatar brianteeman
brianteeman
15 Jun 2021

A message was added #33097


## If your site starts to look strange after enabling this, and you see
##     ERR_CONTENT_DECODING_FAILED in your browser console network tab,
##     then your server is already gzipping css and js files and you don't need this
##     block enabled in your .htaccess

Hopefully people will read :-) and understand.

I managed to track down my issue to the htaccess file but as I had no ERR_CONTENT_DECODING_FAILED or any other error in my console I ignored the message - even though it did appear to solve the issue

There must be a better way than breaking the site and then being skilled enough to locate where the error is coming from and then guessing the fix. Especially as the fix is "outside" the joomla ui.

avatar brianteeman brianteeman - open - 15 Jun 2021
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jun 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Jun 2021
avatar brianteeman brianteeman - change - 15 Jun 2021
The description was changed
avatar brianteeman brianteeman - edited - 15 Jun 2021
avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

The message was added to help... imagine how hard it was before the helpful message... :)

avatar brianteeman
brianteeman - comment - 16 Jun 2021

in my case I only saw the message AFTER I had found the problem

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

yes - because Historically Joomla has never checked if a server is already going to gzip the sites output once PHP hands the response back to apache, before apache once again gzipping (and therefore corrupting) the output.

I guess the change you are after is finding a way to tell if a server is going to gzip the output after Joomla with a crystal ball ahead of time, and therefore not firstly (unperformantly) first gzipping using PHP code.

There are several things that can enable GZIP

  1. Joomla. This gzips the HTML response if gzip is enabled in Joomla Global Config.
  2. .htaccess - in Joomla 4 will attempt to serve, precompressed, gz asset files if found.
  3. .htaccess - this can be configured to gzip the HTML response AND all other assets
  4. .htaccess - configured by copy and paste from most online FAQ questions - this gzips the JS/CSS responses only
  5. Web Server - can be configured a myriad of ways, to gzip some, all, or most assets depending on mime type

I vote for removing GZIpping in Joomla Global Config, all the other options are far more performant than compressing in PHP.

But that still leaves your problem... a myriad of ways a server can be configured, and config overruled by .htaccess rules...

avatar brianteeman
brianteeman - comment - 16 Jun 2021

and remember i have no console errors

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

and remember i have no console errors

You dont actually report what the problem you had was...

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

Im going to guess you had the same issue as #32892

In SOME browsers you would see:

114297879-69e50a00-9add-11eb-956d-23722a2d3a54

avatar brianteeman
brianteeman - comment - 16 Jun 2021

image

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

and if you tried to go direct to one of those JS files - does your browser refuse to show the JS file? with a ERR_CONTENT_DECODING_FAILED across the middle of the page?

avatar brianteeman
brianteeman - comment - 16 Jun 2021

as i said no problems
image

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

Are you even sure your issue is a gzip issue? As the content type in that screenshot is just plain js

avatar brianteeman
brianteeman - comment - 16 Jun 2021

as soon as I comment out these lines it works correctly

	RewriteCond "%{HTTP:Accept-encoding}" "gzip"
	RewriteCond "%{REQUEST_FILENAME}\.gz" -s
	RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]
avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

But do you have *.css.gz files next to your *.css files or are they missing?

avatar brianteeman
brianteeman - comment - 16 Jun 2021

image

avatar PhilETaylor
PhilETaylor - comment - 16 Jun 2021

Strange as your screenshot has the JS tab selected and not the css tab !?

What's the css tab look like?

avatar brianteeman
brianteeman - comment - 16 Jun 2021

ok problem solved (i think)

I just deleted the entire css folder and rebuilt with npm

there are now no gz files at all

So I am going to guess two thing (before checking)

  1. the build script overwrites the existing css - it does not delete the folder and rebuild from scratch
  2. the build script no longer builds the gz files on my system

As a result the gz css files that were being loaded were just old and out of date

avatar brianteeman
brianteeman - comment - 16 Jun 2021

dont have any more time today to look into it

avatar dgrammatiko
dgrammatiko - comment - 24 Jun 2021

So I am going to guess two thing (before checking)

  • the build script overwrites the existing css - it does not delete the folder and rebuild from scratch
  • the build script no longer builds the gz files on my system

You're right for both, the build tools just rebuild the css/js without recreating the .gz neither refreshing the hash for the invalidation. For those 2 you need to run the commands separately (npm run gzip and npm run versioning)

The reasons that these commands are not executed directly on npm install are:

  • the process will be longer
  • it's harder to debug/develop with both the .gz and a fixed version (you need to constantly invalidate the static assets)
  • both these commands are supposed to be part of the build process for the release

That said, I find it kinda weird that you had .gz files in a cloned repo, but as a final solution for everything npm related: delete both the media folder and the node_modules and re run npm install (templates also need extra step here till everything static is finally served from the media folder [talking about the child templates])

avatar brianteeman brianteeman - change - 24 Jun 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-06-24 22:22:50
Closed_By brianteeman
avatar brianteeman brianteeman - close - 24 Jun 2021

Add a Comment

Login with GitHub to post a comment