By Graham SAfterburner - Advanced S3 Caching is a simple plug-in which automatically adds additional Expires headers on S3 hosted compressible, cacheable CSS and JS theme files.
Adds additional HTTP Expires Headers automatically to each S3 hosted relevant, publicly cacheable, compressible IPS theme JS/CSS file. Includes compatibility updates for current major version of IPS. Works on all installed themes JS/CSS resources stored within your S3 bucket, both official and third party themes, with no limit on number of themes. Fire and forget - just leave enabled. Works silently in the background, whenever IPS Community Suite exports theme resources to AWS S3. Even if you install a new theme. Potential to boost SEO performance, since Google favours faster loading websites. Requires a pre-configured working AWS S3 storage bucket configuration.
Works either with or without an optional CDN such as Cloudfront, Cloudflare etc.
What's it for?
This plugin was originally created for IPS Community admins who use S3 storage buckets and in particular sought increased caching performance and a higher GTMetrix score. After a lot of research, trial and error trying to identify the reason for Amazon S3 hosted, compressible IPS4 theme resources were failing Vary: Accept Encoding tests at GTMetrix, I realised it was because S3 needs to have additional Expires headers as well as the more modern Cache-Control headers IPS sets by default. IPS declined to add them by default so Afterburner was created to sit in the background and quietly inject the Expires headers automatically, instead of them needing to be added manually whenever theme CSS and JS files were updated.
You are hosting your IPS4 Community's Theme Resources at AWS S3. You could add extra HTTP Expires headers yourself to every file, but ideally you need to automate this process because each time IPS Community recaches either by itself or manually via the Support Tool, it will overwrite your modified files.
So how does it work?
Afterburner S3 Caching automatically adds Expires headers to each .gz files via Curl or Socket type IPS file transfers by hooking into both, depending upon how your server is configured.
Thanks to BFarber for suggesting alternative HTTP hook-points.
Compatible ONLY with IPS Community Suite 4.4 series. Developed on 4.3 and tested on all current versions of 4.4, and 4.3.6.
Requires a pre-configured and properly working Amazon AWS S3 storage bucket (Versioning mode recommended), correctly set up in IPS Community AdminCP to host your Theme Resources (Files > Storage Settings under Theme Resources). See the IPS Help Guide for more.
How do I install/upgrade Afterburner?
After downloading the plugin for IPS 4.4, 4.3, 4.2, install the Afterburner XML file via the AdminCP > System > Plugins > Install New Plugin facility. Later versions will be manageable via the Marketplace for IPS 4.5.
I recommend running the AdminCP Support Tool after installing/updating the plugin to re-cache and upload ALL relevant files rather than waiting for the next scheduled task or manual action that will update them.
If you are also using a CDN such as Cloudfront, Cloudflare etc, I also found it useful in testing to clear/invalidate Cloudfront/Cloudflare afterwards, instead of waiting for them to update themselves when they next routinely check for updated files and send to their respective Edge locations.
If you're not using AWS Cloudfront, you need to make your theme files publicly readable. If you are using Cloudfront, follow best practice and make your files non-public, but accessible via an OAI credential and API Key in your bucket policy.
Does it work on cloud hosted IPS Communities (CiC)?
I don't see why not, as long as you have S3 hosted theme resource files, but I only have self hosted IPS sites myself.
Cool! How do I know it's working?
There are a few ways to test! GT Metrix, the AWS Console, your Browser Console etc.
You can benchtest your site at GTMetrix before and afterward installing but if you look at the Waterfall tab of your test results, and choose a gzipped JS or CSS theme file hosted in your S3 bucket, you should see similar to this:
Alternatively, another way to check is at the source, use the Amazon S3 Bucket Console to view the Meta headers on the actual stored gz files, as seen in the screenshot below:
Another way to see if the Expires headers have been added to your S3 hosted cacheable JS/CSS files, is to use the developer console in your Chrome or Firefox browser (hit F12 and reload the page):
By Graham S