canonical / ubuntu.com

The official website for the Ubuntu operating system
https://ubuntu.com
Other
185 stars 189 forks source link

Brotli encoding used when not accepted by client #13980

Open rodarima opened 1 week ago

rodarima commented 1 week ago

See context here: https://lists.mailman3.com/hyperkitty/list/dillo-dev@mailman3.com/message/IJ5DAPK5B2MVQ363E677YFHLJ752Q5IG/

When loading (at least) the following pages in Dillo:

They are returned encoded with Brotli:

content-encoding: br

When the browser is requesting those pages with support for gzip and deflate only.

Here is a reproducer with CURL:

hop% curl -I -H 'Accept-Encoding: gzip, deflate' https://ubuntu.com/navigation
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Fri, 21 Jun 2024 18:51:33 GMT
content-type: text/html; charset=utf-8
x-view-name: webapp.views.navigation_nojs
x-clacks-overhead: GNU Terry Pratchett
permissions-policy: interest-cohort=()
cache-control: max-age=60, stale-while-revalidate=86400, stale-if-error=300
x-frame-options: SAMEORIGIN
x-content-type-options: NOSNIFF
x-vcs-revision: 1718983740-db5b8f6
x-request-id: 5d66aeb6-8697-49ff-b5d5-21979ffa7aaf
strict-transport-security: max-age=15724800
link: <https://assets.ubuntu.com>; rel=preconnect; crossorigin, <https://assets.ubuntu.com>; rel=preconnect, <https://res.cloudinary.com>; rel=preconnect
content-encoding: br <----------- here
x-cache-status: HIT from content-cache-il3/0

Depending on the request being cached, you may have different results:

hop% for i in {1..10}; do curl -sI -H 'Accept-Encoding: gzip, deflate' https://ubuntu.com/tutorials/configure-ssh-2fa | grep content-encoding; sleep 1; done
content-encoding: br
content-encoding: br
content-encoding: gzip
content-encoding: gzip
content-encoding: gzip
content-encoding: gzip
content-encoding: gzip
content-encoding: br
content-encoding: gzip
content-encoding: gzip

You can use any tutorial link in https://ubuntu.com/tutorials to reproduce this issue if the server has cached the response and it doesn't serve Brotli anymore.


Reported from: https://ubuntu.com/navigation