How to debug mod_pagespeed with cURL

If you ever wondered what mod_pagespeed was doing, why it was skipping some resources or you just want to make sure it is not having any difficulty then there is an easy way to debug any page of any website using a cURL request. This is especially useful when you are trying to configure mod_pagespeed to compress images on a website, I personally have had many issues where certain configuration is needed so that mod_pagespeed can access and cache the resources and you end up trying multiple guides to figure out the issue, now you dont have to!

Open an SSH terminal and run the following command, this command will fetch a url with mod_pagespeed debug turned on and will write the output to a file in the current directory, so you might want to CD to a familiar location first.


curl -H "PageSpeedFilters: +debug" https://www.mywebsite.com -o modpagespeeddebug.txt


Once complete open modpagespeeddebug.txt in your favourite editor and you will see it is a full snapshot of the HTML source of the page, however next to various resources you will see HTML comments which are debug strings from mod_pagespeed. By reading the debug you should have a clearer understanding of what if anything is going wrong.

And finally at the very bottom of the output you will see a list of the filters and settings currently active.

Have fun!

Author: Dean Williams

Professional PHP Web Developer with expertise in OpenCart Web Development, WordPress Web Development, Bespoke Systems - also a seasoned Linux Server Administrator.

Leave a Reply

Your email address will not be published. Required fields are marked *