Ad

MIME Type Conflict With TYPO3 Compressed CSS And JS Resources

- 1 answer

I am rather new to TYPO3. Recently I noticed some very weird behavior in my installation: Some CSS-files in the directory typo3temp/assets/compressed got the MIME-type text/html instead of the expected text/css. Therefore my browser received a 403 Forbidden status code from the webserver for these resources. That resulted in some parts of the backend being shown without styling.

I tried clearing all caches and deleting the typo3temp/assets/compressed directory, however now all the stuff in there (CSS and JS) is served with MIME-type text/html. Getting the backend without JavaScript means, that I am now basically locked out of the backend. I can however still reach and use the install tool.

Do you have any ideas how this might happen and how to fix it?

Some details of my setup:

  • TYPO3 v10.4.13 (recently updated from 10.4.9)
  • Apache web server (I don't have access to its config and have to rely on .htaccess files)
Ad

Answer

I suggest to set

TYPO3_CONF_VARS/FE/compressionLevel=0
TYPO3_CONF_VARS/BE/compressionLevel=0

in order not have these kind of problems. The problem is that this compression creates compressed files but relies on webserver configuration in order to deliver them as text/css and NOT applying the default webserver's transport compression to them (or they could end up double-compressed and you might not even easily notice - some browsers can deal with that, others not).

It is a kind of micro-optimization that sounded useful in times when we avoided https:// because of the processing overhead...

Here's some docs (the first statement is outdated in my oppinion): https://docs.typo3.org/m/typo3/reference-skinning/master/en-us/BackendCssApi/CssCompression/Index.html

Ad
source: stackoverflow.com
Ad