Compressing static files served from a reverse proxy
Added by josephpconley@gmail.com over 12 years ago
I'm using lighttpd as my front-end server for both static and dynamic websites. I've setup a reverse proxy for my dynamic applications (served by Play! Framework) using mod_proxy. I've just added the mod_compress module to gzip all static resources and this works for my static site without issue. However, I noticed that static resources served from my dynamic site via the reverse proxy do not get compressed. Any idea why that is? Does the reverse proxy somehow bypass compression?
OS: tried both Windows 7 64-bit and CentOS 64-bit (micro EC2 instance)
Lighttpd version: LightTPD/1.4.30 for Windows, 1.4.32 for EC2
Browser: Chrome
Config (Windows):
#config
server.modules = ("mod_expire", "mod_access", "mod_accesslog", "mod_alias", "mod_auth", "mod_cgi", "mod_proxy", "mod_redirect", "mod_setenv", "mod_compress")
alias.url = (
"/home/images" => "C:/workspace/home/images",
"/home" => "C:/workspace/home"
)
mimetype.assign = (
".html" => "text/html",
".xml" => "text/xml",
".js" => "text/javascript",
".css" => "text/css",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png"
)
compress.filetype = ("application/x-javascript", "application/javascript", "text/javascript", "text/plain", "text/css", "text/xml", "text/html")
compress.cache-dir = "C:/lighttpd/logs/cache"
$HTTP["host"] =~ "localhost" {
$HTTP["url"] =~ "^/home(\S)*" {
#let lighttpd serve using aliases above
}
else $HTTP["url"] != "^/home(\S)*" {
proxy.balance = "round-robin"
proxy.server = (
"/app1" => ( ( "host" => "127.0.0.1", "port" => 9100 ) ),
"/app2" => ( ( "host" => "127.0.0.1", "port" => 9200 ) ),
"/" => ( ( "host" => "127.0.0.1", "port" => 9000 ) )
)
}
}
server.document-root ="c:/workspace/home/"
server.port = 80
server.errorlog = "C:/lighttpd/logs/error.log"
index-file.names = ( "index.html" )
Replies (1)
RE: Compressing static files served from a reverse proxy - Added by stbuehler over 12 years ago
"static files from a backend" obviously don't count as static files in the frontend. either serve them as static files in the frontend, or compress them in the backend.