Issue Summary
Since Bitbucket 6.10.3 application/javascript MIME type files are not getting compressed by Bitbucket before being sent to the client.
By default all the MIME types:
text/css,text/html,text/javascript,text/json,text/plain,text/xml,text/x-javascript,\ application/javascript,application/json,application/x-javascript,application/vnd.git-lfs+json
should be compressed, however, even with listing application/javascript explicitly with server.compression.mime-types they are not.
Some files (like batch.js) can grow up to a few megabytes, and with a particular number of users, it adds quite a lot of unnecessary network overhead.
Steps to Reproduce
- Step 1
Run development panel in any web browser in incognito mode and go to the Network tab. - Compare Transferred size with Size.
Expected Results
In Bitbucket versions prior to 6.10.3: Transferred < Size.
Request headers:
HTTP/1.1 200 X-AREQUESTID: @EF28NQx1251x71x1 X-ASESSIONID: 1rn7ng6 X-ASEN: SEN-500 Expires: Thu, 27 May 2021 18:51:37 GMT Cache-Control: max-age=31536000 Cache-Control: public x-xss-protection: 1; mode=block x-frame-options: SAMEORIGIN x-content-type-options: nosniff Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT ETag: "0" vary: accept-encoding Content-Encoding: gzip Content-Type: application/javascript Transfer-Encoding: chunked Date: Wed, 27 May 2020 18:51:37 GMT
Actual Results
In Bitbucket 6.10.3+ Transferred > Size.
Request headers:
HTTP/1.1 200 X-AREQUESTID: @NH6EKAx1255x590x0 X-ASESSIONID: 1l8vu49 X-ASEN: SEN-500 Expires: Thu, 27 May 2021 18:55:25 GMT Cache-Control: max-age=31536000 Cache-Control: public x-xss-protection: 1; mode=block x-frame-options: SAMEORIGIN x-content-type-options: nosniff Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT ETag: "0" Content-Type: application/javascript Transfer-Encoding: chunked Date: Wed, 27 May 2020 18:55:24 GMT Keep-Alive: timeout=20 Connection: keep-alive
Lack of:
vary: accept-encoding Content-Encoding: gzip
This is not browser-specific, happens also without any reverse proxies while accessing Bitbucket directly.
Workaround
The content-type of batch.js is application/javascript. If the issue occurs in the environments behind load balancers/reverse proxies it should be possible to offload the compression to them.
For HA Proxy, please add to Bitbucket HTTP backend section in haproxy.conf:
backend bitbucket_http_backend compression algo gzip compression type application/javascript
and reload the load balancer.
- mentioned in
-
Page Loading...