Brotli is a modern compression algorithm for the web to replace the aged Gzip. Developed by Google it is currently supported in all major browsers:

Can I Bro?

Used with a medium compresson level (e.g. 5) it can both be faster and produce smaller payload sizes than Gzip, win win!

Unlike Perl it’s common to run Go servers without a front-end server like nginx infront, therefore we wanted the ability to generate brotli encoded content in Go. The result is negroni-brotli:

package main

import (


func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {

    n := negroni.Classic()