Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type application/javascript is being served uncompressed #819

Closed
brontolosone opened this issue Dec 6, 2024 · 0 comments · Fixed by getodk/central-frontend#1081 or #820
Closed
Assignees
Labels
ops Docker, nginx, ops to deploy Central performance Performance, benchmarking

Comments

@brontolosone
Copy link
Contributor

brontolosone commented Dec 6, 2024

Problem description

Nginx in both production and development setups is not configured to gzip-compress the application/javascript content-type. The config marks the application/x-javascript content-type as a candidate for compression, but that's a deprecated mimetype and is not what the nginx file-to-mimetype mapping, or the OS's file-to-mimetype mapping, will derive for a *.js filename.

Absent any comment as to why application/javascript is not included in the compressible type, and considering the advantages of compressing it, I'm assuming that the current behaviour is not the intended behaviour.

Steps to reproduce the problem

Note: when staging gets upgraded, there may be a new chunk-vendors.*.js file, so the below URL may need to be adjusted if you're trying this in the future.

curl --no-progress-meter -v --compressed https://staging.getodk.cloud/js/chunk-vendors.37e8929b.js | gzip -1 | wc -c 
<snip/>
> GET /js/chunk-vendors.37e8929b.js HTTP/1.1
> Host: staging.getodk.cloud
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> 
* Request completely sent off
<snip/>
< HTTP/1.1 200 OK
<snip/>
< Content-Type: application/javascript
< Content-Length: 306319
125257

Shown is that a) no transport compression is being applied — no Content-Encoding header is present in the response; and b) the response is large enough to meet the gzip_min_length criterium, and c) the response is in fact quite compressible (ratio 2.5×), thus it would be worthwhile to enable it.

I see the same lack of transport compression in my browser's devtools by the way. CSS gets compressed, JS doesn't.

@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Dec 6, 2024
@matthew-white matthew-white moved this from 🕒 backlog to ✏️ in progress in ODK Central Dec 6, 2024
@matthew-white matthew-white added ops Docker, nginx, ops to deploy Central performance Performance, benchmarking labels Dec 6, 2024
@matthew-white matthew-white linked a pull request Dec 6, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ops Docker, nginx, ops to deploy Central performance Performance, benchmarking
Projects
Status: ✅ done
2 participants