Caching and Errors

PageSpeed Service was turned off on August 3rd, 2015. Please see Turndown Information for PageSpeed Service.

PageSpeed Service allows you to see the number and source of HTTP errors on your site. You can also flush caches of content that is causing errors, or for any other reason. This is available via the Caching and Errors tab, available under PageSpeed Service after logging into the Google APIs Console.


This plot lists the number of HTTP errors served on your website over the last 24 hours. The index for the plot lists each error type, along with the number of occurrences in parentheses. HTTP error counts are not only for HTML pages, but also for images, CSS and JavaScript requests. Since resources are typically about 10 to 20 times more than HTML requests, the number of errors may be higher than the number of HTML requests.

The table below the errors plot lists the top errors sorted by URL. This information can be used to identify the offending URL and fix the error. Refer to the description of HTTP errors to understand and fix these errors. These errors typically occur because the origin site serves these errors. Here are some of the most common errors.

  • 404 - Not found.
  • 502 - Bad Gateway. The origin server sent an invalid response.

PageSpeed Service uses some additional error codes to identify non-standard errors.

  • 520 - Origin server timed out. This typically happens when the origin host is not serving pages. Please check your origin servers.
  • 521 - There was an error within PageSpeed Service while handing the request.
  • 522 - You configured PageSpeed Service incorrectly. See here for more details on fixing it.
  • 523 - User was blocked as a result of a filtering rule in the Block Requests panel.
  • 524 - DNS lookup failure. This can happen if the DNS name for the origin host cannot be resolved. Check the DNS configuration for your origin host.

Note: If you have more than 10 URLs that have errors, the error table may not add up to 100%.

Flushing cache

PageSpeed Service allows you to purge resources and HTML that match a specified URL wildcard pattern from its internal cache. This can be useful in case of emergencies, for example when you have modified a page or resource on the origin server and want to ensure that it is immediately served to your users. Watch this short video for an overview of how to use this feature, and read on for more details.

There are two ways to use this feature:

  • The "Both HTML and Resources" option purges all resources (images, CSS and Javascript) and HTML that match the specified pattern. This is the default option. e.g. www.example.com/images/*.jpg will purge all JPG images in the /images/ path.
  • The "Only HTML" option purges only HTML files that match the specified pattern. Use this option if you use the "Cache and prioritize visible content" rewriter and want PSS to pick up changes on your pages earlier than the specified cache time. e.g. www.example.com/page1.html will purge the HTML file page1.html from PageSpeed server's caches.

You can specify up to 20 URL patterns per project - older patterns will not be respected once the limit is exceeded. You can verify the respected patterns from the Audit logs tab in the console. Once your site's cache is successfully flushed, a message will appear below the Flush button indicating when the flush completed.

Note that this feature should be used sparingly. Unnecessary cache purges may reduce the effectiveness of PSS by increasing traffic to the origin domain and slowing down your site. Also note that only project owners can flush the cache; project members with non-owners access will get an error message when they attempt to use this feature.

The preferred method of controlling the duration for which PageSpeed Service will cache resources on your webpage is by setting the appropriate value in the http Cache-Control header. If this value is set to no-cache or 0 then such resources will not benefit from caching by PageSpeed Service. We recommend setting Cache-Control headers of only HTML pages to no-cache. All other resources, such as images, JavaScript and CSS should have a Cache-Control duration of greater than 0 seconds.