Apache and Tomcat: Proxy, Caching and Compression configuration
947 views
Skip to first unread message
P.G.Taboada
unread,
Jan 27, 2011, 7:20:51 AM1/27/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Hi there,
it took me a while to get all pieces together so I wanted to share my
configuration. I have an apache as a proxy, tomcat serving the app and
lots of clients. So I wanted to setup compression and expiration
headers properly.
- Almost all browsers nowedays support gzip, so why not gzip them by
default..?.. instead of gzipping them on every http request... not
needed...
You can tell GWT to output all your files as gzip. Then use apache
httpd multiview to send the correct file.
Then let apache httpd inflate the file if you encounter a browser that
doesn't support gzip..(rare these days).
- Use Yslow plugin for FF to fine tune your settings.
- Don't forget to set the correct caching for the css, images, third
party js files, etc...
- Put your gwt files directly under apache httpd instead of tomcat
(noserver mode). Performs much better. Only use tomcat for rpc and
other backend calls.
Then you don't need the proxymatch settings and just use Files
settings...performs a bit better...
I got this all working very nice and you notice the performance gain
big time as I also have the nightly build without all these optimized
http settings...
Here you got a http snippet that I use, hope it helps you:
----
# Add inflate (uncompress) filter that will be used when the browser
doesn't support
# gzip
# Ref: http://httpd.apache.org/docs/2.2/mod/mod_filter.html FilterDeclare gzinflate CONTENT_SET
FilterProvider gzinflate inflate req=Accept-Encoding !$gzip
<Files *.cache.*>
ExpiresActive on
ExpiresDefault "now plus 1 year"
</Files>
# Note: this only matches the file name and not the preceding
directory
<FilesMatch "\.(gif|jpe?g|png|ico|css|xml)$">
ExpiresActive on
ExpiresDefault "now plus 3 day"
</FilesMatch>
<Files ext.js>
ExpiresActive on
ExpiresDefault "now plus 3 day"
</Files>
# Tell apache to use the compressed files if possible
#SetOutputFilter DEFLATE
#
# Deflate by type
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Thanks a lot for your comments. I am trying not to take static
resources out of tomcat as it would make deployment slightly more
complicated, but I have it in mind as soon as I run into performance
issues.
I am struggling a little bit with the split points: although http
headers are set to expire in far future, the browser keeps reloading
the split points (the .js files).
I will update my posting to include your comments asap.
brgds,
Papick
On Jan 27, 2:31 pm, Ed <post2edb...@gmail.com> wrote:
> Thanks.
> A few things:
> - ProxyPassReverse don't work with ajp...
> See:http://www.humboldt.co.uk/2009/02/the-mystery-of-proxypassreverse.html > You can simple test it by performing a redirect on tomcat
>
> - Almost all browsers nowedays support gzip, so why not gzip them by
> default..?.. instead of gzipping them on every http request... not
> needed...
> You can tell GWT to output all your files as gzip. Then use apache
> httpd multiview to send the correct file.
> Then let apache httpd inflate the file if you encounter a browser that
> doesn't support gzip..(rare these days).
>
> - Use Yslow plugin for FF to fine tune your settings.
>
> - Don't forget to set the correct caching for the css, images, third
> party js files, etc...
>
> - Put your gwt files directly under apache httpd instead of tomcat
> (noserver mode). Performs much better. Only use tomcat for rpc and
> other backend calls.
> Then you don't need the proxymatch settings and just use Files
> settings...performs a bit better...
>
> # Note: make sure to not set the "AddType application/x-gzip .gz .tgz"
> as then all the gzp files will
> # be returned with the wrong content-type (as gzip instead as the
> zipped content: js/css, etc...)
>
> Options +MultiViews
> AddEncoding x-gzip .gz
> RemoveType application/x-gzip .gz .tgz
>
> # Enabled the inflate filter
> FilterChain gzinflate
>
> # GWT Optimization.
> # ref:
> #http://www.infoq.com/articles/gwt-high-ajax