question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Just curious if there are plans to add support for brotli compression?

Saw the implementation in ktor-server/ktor-server-core/src/io/ktor/features/Compression.kt for Gzip and Deflate. Wanted my application to respond with a brotli compressed js script (as it is 30% smaller than the gzip version) but failed to overwrite the Content-Encoding in the response header with br.

Miserable attempt: (the file was already compressed outside of ktor)

get("/bundle.min.js") {
   // attempt 1
    call.respondFile(File("public/js/bundle.min.js.br"), {
        setProperty(AttributeKey("Content-Type"), "application/octet-stream")
        setProperty(AttributeKey("Content-Encoding"), "br")
        finish()
    })
   // attempt 2 bout = ByteArrayOutputStream
    call.respondWrite(ContentType.Application.OctetStream, HttpStatusCode.OK, { bout })
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

0reactions
oleg-larshincommented, Aug 10, 2020

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Brotli Accept-Encoding/Content-Encoding - CanIUse
1 Supported in Chrome and Opera behind the 'Brotli Content-Encoding' flag · 2 Enabled since 27 May 2016 · 3 Support starting with...
Read more >
Brotli Support - Akamai TechDocs
Brotli is an open-source, lossless data compression algorithm that has a higher compression rate than gzip. With Brotli Support enabled, the CDN can...
Read more >
Brotli - Wikipedia
A successor to gzip, it is supported by all major web browsers and has become increasingly popular, as it provides better compression than...
Read more >
Brotli Test - Verify Brotli Compression Support - KeyCDN Tools
Test if a server supports the Brotli compression. The Brotli algorithm, which is the successor of Gzip, allows better and faster compression results....
Read more >
Cross Browser Compatibility of Brotli Accept-Encoding ...
Brotli Accept-Encoding/Content-Encoding is Not Supported on Safari 9, which means that any user who'd be accessing your page through Safari ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found