PageSpeed with HTTPS, Apache and Tomcat

Feb 21, 2016


PageSpeed is a tool by Google which rewrites/optimizes resources served by your web server so that your site loads faster. I think it was designed to work with sites that largely serve static content. Most PHP based sites are like that. For example, Wordpress installations can directly reside in the DocumentRoot of Apache. That makes it straightforward to configure PageSpeed. But if you are using a Java web application fronted by Apache, the PageSpeed documentation doesn't help you much.

PageSpeed configuration for dynamic content

If your web application serves content using a URL which does not map to a physical location in your DocumentRoot, PageSpeed will not be able to find it. For example, this blog runs on Apache Roller which serves static files using a logical path and not a physical path. If relative to your web application's root, the CSS files are present in this phsyical location:

roller/themes/alaru/css/

And the CSS files are served with this logical URL:

https://satishchilukuri.com/blog/resource/css/

PageSpeed will try to look for this physical location relative to DocumentRoot:

blog/resource/css

Read more...