Unable to disable brotli/gzip compression

Description

I am hosting a customer ecommerce website (Medusa JS) with nodeJS through passenger (and also tried through regular proxypass in .htaccess).
When accessing the site, the browser load some .js assets and they are compressed, so the browser is throwing error when reading the script file.

Uncaught SyntaxError: Invalid or unexpected token (at script.js:1:1)

I tried to disable brotli and gzip completly for this site but it is not working.

I tried those variant in .htaccess and also in the /etc/httpd/conf/siteX{.ssl}/custom

# Try 1
SetEnv no-brotli 1
SetEnv no-gzip 1

# Try 2
RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]

# Try 3
<IfModule brotli_module>
  SetEnv no-brotli
</IfModule>

I am seeing there is a compression option in medusa (6.3. Medusa Application Configuration - Medusa Documentation)
But this is set to false.

I understand that it might not be a problem with APISCP configuration but I just wanted to make sure.
Basically I would like to know if I am missing something about disabling compression on the httpd side.

Environment

ApisCP version: cpcmd misc:cp-version

[root@dash-mini ~]# cpcmd misc:cp-version
revision: a167cef15535ffcb8837e6b9a291699ec113b7c0
timestamp: 1775061482
ver_maj: 3
ver_min: 2
ver_patch: 0
ver_pre: a167cef15-dirty
dirty: true
debug: false

Operating System: uname -r

6.12.0-55.40.1.el10_0.x86_64

Thank you for your help.

no-brotli has the same effect as no-gzip per source.

Per Apache documentation:

There is an environment variable no-brotli , set via SetEnv , which will disable brotli compression for a particular request, even if it is supported by the client.

So that should work OK. I’d check that Pagespeed isn’t interfering with the request:

<IfModule pagespeed_module>
    ModPagespeed off
</IfModule>

Hello,

Thank you for your quick response as always !
I will try some more configuration as you stated.

Also, I noticed a cache on the apache/httpd side.
For example, when I proxy pass all requests to my node app, if I shutdown the node app that is serving all my assets, I can still request some assets. But my node app is down, so there must be a cache with apache. I could not find information on the APISCP documentation about it.

I tried to disable all cache (TBH probably in the wrong way) but I cannot make this work…
How can I disable cache in the .htaccess or in the /etc/httpd/conf/siteX/custom ?

Again, thank you for you time and support,
have a great weekend.

Browser also has a cache. This is most likely what you’re seeing.

Unfortunately, I was able to reproduce with simple curl.

With curl I was able to get some assets despite my node app was not running.
Then in my curl I added ?no_cache=$(date +%s), and only with this new param I get 502 bad gateway.

But then If I curl the assets without this extra get param, I was able to get the asset even if my node was down.
Thank you,

It’s Pagespeed or implicit caching. There’s nothing else in the way.

For example :

$ curl https://xxx.com/app/assets/index-BqzOA_eK.css
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

$ curl https://xxx.com/app/assets/index-BqzOA_eK.css?test
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
</body></html>

$ curl https://xxx.com/app/assets/index-BqzOA_eK.css
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

I curl directly from my PC to APISCP with /etc/hosts file modified so my domain resolv directly to APISCP IP (no cloudflare or third party)

for all those request the node app was down.
And I have this problem about binary data despite requesting a css file.

I will look at the link you provided.
Thank you

So by default caching is not enabled ? (Which is what I would want)

# Enable memory-backed caching in Apache
cpcmd scope:set apache.cache memory
# Require sites to opt-in with "UnsetEnv no-cache"
cpcmd scope:set apache.cachetype explicit

So indeed, as you stated adding this to my .htaccess solved all my problems :

<IfModule pagespeed_module>
    ModPagespeed off
</IfModule>

Thank you for your time and advices.