mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:04:39 +03:00
implement transparent gzip compression in the webserver
we only compress if applicable (content-type indicates likely compressible), client supports it, response doesn't already have a content-encoding). for internal handlers, we always enable compression. for reverse proxied and static files, compression must be enabled per handler. for internal & reverse proxy handlers, we do streaming compression at "bestspeed" quality (probably level 1). for static files, we have a cache based on mtime with fixed max size, where we evict based on least recently used. we compress with the default level (more cpu, better ratio).
This commit is contained in:
7
testdata/webserver/domains.conf
vendored
7
testdata/webserver/domains.conf
vendored
@ -21,9 +21,10 @@ WebHandlers:
|
||||
Domain: mox.example
|
||||
PathRegexp: ^/static/
|
||||
DontRedirectPlainHTTP: true
|
||||
Compress: true
|
||||
WebStatic:
|
||||
# This is run from the http package.
|
||||
Root: ../testdata/web
|
||||
Root: ../testdata/webserver
|
||||
ListFiles: true
|
||||
ResponseHeaders:
|
||||
X-Test: mox
|
||||
@ -35,14 +36,14 @@ WebHandlers:
|
||||
WebStatic:
|
||||
StripPrefix: /nolist/
|
||||
# This is run from the http package.
|
||||
Root: ../testdata/web/static
|
||||
Root: ../testdata/webserver/static
|
||||
-
|
||||
LogName: httpsredir
|
||||
Domain: mox.example
|
||||
PathRegexp: ^/tls/
|
||||
WebStatic:
|
||||
# This is run from the http package.
|
||||
Root: ../testdata/web/static
|
||||
Root: ../testdata/webserver/static
|
||||
-
|
||||
LogName: baseurlonly
|
||||
Domain: mox.example
|
||||
|
18
testdata/webserver/static/index.html
vendored
18
testdata/webserver/static/index.html
vendored
@ -1 +1,19 @@
|
||||
html
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
when larger than 1kb, it will be transparently compressed.
|
||||
|
Reference in New Issue
Block a user