Porting mod_pagespeed to Another System

  • mod_pagespeed is designed to be modular and largely independent from Apache, making it portable to other servers and systems.

  • To integrate mod_pagespeed, developers primarily need to work with the net/instaweb/rewriter directory and implement a subclass of RewriteDriverFactory.

  • Porting requires implementing specific classes like MessageHandler, FileSystem, and UrlFetcher for the target environment, with examples provided in the apache/ directory.

  • The integration process involves using methods like StartParseWithType, ParseText, and FinishParse to handle content rewriting.

  • Developers are encouraged to communicate with the mod_pagespeed development mailing list for support and to avoid potential integration issues due to internal interface changes.

Do you want to port mod_pagespeed to another server or integrate it in another system? Great! We developed mod_pagespeed to be modular and almost completely independent from Apache. The only Apache-specific code is in the net/instaweb/apache directory.

If you look into our source, our main code is in net/instaweb/:

  • util/ and http/ have many of our basic tools, including abstract base classes like MessageHandler, Timer, and UrlFetcher. There are some example implementations, but you will have to make your own implementations of many of these.
  • htmlparse/ has the core HTML parser. You shouldn't have to deal with that at all.
  • rewriter/ has the rewriting filters and framework. The central integration point is the partially abstract class here, RewriteDriverFactory. Your integration effort will start by subclassing it and implementing its pure virtual methods.

You will probably have to implement a port for the following classes (see example implementations in the apache/ directory):

Then to actually invoke the code, you'll need to create a FooRewriteDriverFactory to create all your objects, and then StartParseWithType(url, content_type), ParseText(text) between each flush of the server, and FinishParse() for each request.

Please write to our development mailing list if you are looking into this or having any problems. We are not guaranteeing that any internal interfaces will stay the same, so we could easily break your port if we don't know that you are using them.