Skip to content

Instantly share code, notes, and snippets.

@mailopl
Last active June 9, 2016 20:42
Show Gist options
  • Save mailopl/9069668 to your computer and use it in GitHub Desktop.
Save mailopl/9069668 to your computer and use it in GitHub Desktop.
mod_pagepseed full config with comments
<IfModule pagespeed_module>
ModPagespeed On
ModPagespeedRewriteLevel PassThrough
#ModPagespeedEnableFilters convert_jpeg_to_webp,convert_jpeg_to_progressive
# The 'Add Instrumentation' filter injects two small blocks of JavaScript into every HTML page. These blocks measure the time the client spends
# loading and rendering the page, and report that measurement back to the server.
# LOW RISK
ModPagespeedEnableFilters add_instrumentation
# The filter rewrites pages that load the Google Analytics tracking code synchronously to load it asynchronously instead. Loading Google Analytics
# asynchronously has the advantage that it will not block resources that load later in the page.
# LOW RISK
ModPagespeedEnableFilters make_google_analytics_async
# Uses CDN libraries if found a match
# LOW RISK
ModPagespeedEnableFilters canonicalize_javascript_libraries
# Trims whitespace in HTML
# LOW RISK
ModPagespeedEnableFilters collapse_whitespace
# Reduces CSS requests
# LOW RISK
ModPagespeedEnableFilters combine_css
# Combines JS
# LOW RISK
ModPagespeedEnableFilters combine_javascript
# defer_javascript tries to defer JavaScript execution until page load. It defers this by changing the type and src attributes of <script> elements
# on the HTML page to pagespeed_orig_type and pagespeed_orig_src respectively. It also adds a new type attribute whose value is set to text/psajs. A
# window.onload handler is added to the HTML, which executes all the deferred scripts.
# HIGH RISK
# ModPagespeedEnableFilters defer_javascript
# The 'Elide Attributes' filter reduces the transfer size of HTML files by removing attributes from tags when the specified value is equal to the
# default value for that attribute.
# LOW RISK
ModPagespeedEnableFilters elide_attributes
# 'Extend Cache' seeks to improve the cacheability of a web page's resources without compromising the ability of site owners to change the resources
# and have those changes propagate to users' browsers.
# LOW RISK
ModPagespeedEnableFilters extend_cache
# Reduce the number of HTTP round-trips by combining multiple CSS resources into one.
# LOW RISK
ModPagespeedEnableFilters flatten_css_imports
# The "Inline @import to Link" filter converts a <style> tag consisting of only @import statements into the corresponding <link> tags.
# LOW RISK
ModPagespeedEnableFilters inline_import_to_link
# The contents of small external CSS resources are written directly into the HTML document; therefore the browser does not request those CSS
# resources independently.
# LOW RISK
ModPagespeedEnableFilters inline_css
# The "Inline JavaScript" filter reduces the number of requests made by a web page by inserting the contents of small external JavaScript resources
# directly into the HTML document.
# LOW TO MODERATE RISK
ModPagespeedEnableFilters inline_javascript
# Generates low quality versions of the images that are inlined in the HTML page. Users experience faster rendering of the page and the low quality
# images are replaced by high quality versions after an onload event is triggered. The filter works on images found in <img> tags.
# MODERATE RISK
ModPagespeedEnableFilters resize_mobile_images
# The lazyload_images filter defers loading of images until they are visible in the client's viewport.
# RISK: CPU cycles to calculate viewport
ModPagespeedEnableFilters lazyload_images
# This filter saves inlined resources to the browser's local storage (an HTML5 feature) on the first view of a page, and loads them from local
# storage on subsequent views rather than sending them (inline) again.
# MODERATE TO HIGH RISK, WONT SPEEDUP FIRST VIEWS
ModPagespeedEnableFilters local_storage_cache
# This filter minifies JavaScript code, using an algorithm similar to that in Douglas Crockford's popular JSMin program. At present, the filter
# strips all comments and most whitespace. The filter works only on JavaScript found in <script> blocks (either as the target of the src attribute, # or within the body of the block).
# LOW TO MODERATE RISK
ModPagespeedEnableFilters rewrite_javascript
#'Move CSS Above Scripts' seeks to make sure scripts do not block the loading of CSS resources.
# LOW RISK
ModPagespeedEnableFilters move_css_above_scripts
# 'Move CSS to head' seeks to reduce the number of times the browser must re-flow the document by ensuring that the CSS styles are all parsed in the
# head, before any body elements are introduced.
# LOW RISK
ModPagespeedEnableFilters move_css_to_head
# Enabling convert_to_webp_lossless causes the image optimizer to attempt to create lossless webp images whenever it encounters gifs or pngs. The
# lossless webp images are only served to modern browsers that support the format (libwebp version 0.2.0 and above).
# LOW RISK
ModPagespeedEnableFilters convert_to_webp_lossless
# This flag inserts width= and height= attributes into <img> tags that lack them and sets them to the image's width and height. Note that this can
# cause image stretching or shrinking if CSS rules specify only one image dimension
# HIGH RISK
ModPagespeedEnableFilters insert_image_dimensions
# This is equivalent to enabling inline_images, recompress_images, convert_png_to_jpeg, and resize_images.
# In every case, the image on the page is replaced by the optimized version only if the optimized version is actually smaller than the original.
# MODERATE RISK, CPU cycles to resize or recompress
ModPagespeedEnableFilters rewrite_images
# Moves small JS to external resources
# MAY NOT IMPROVE PERF AT ALL DEPENDING ON THE SITE
ModPagespeedEnableFilters outline_javascript
# DNS resolution time varies from <1ms for locally cached results, to hundreds of milliseconds due to the cascading nature of DNS. This can
# contribute significantly towards total page load time. This filter reduces DNS lookup time by providing hints to the browser at the beginning of
# the HTML, which allows the browser to pre-resolve DNS for resources on the page.
# LOW RISK
ModPagespeedEnableFilters insert_dns_prefetch
# prioritize_critical_css parses the CSS and replaces it with inlined CSS that contains only the rules used on the page. This avoids any blocking
# CSS requests needed for the initial render. It also collects all CSS tags and appends them to the HTML in the same order they were found. This
# will make all style rules available after page load.
# MODERATE RISK
ModPagespeedEnableFilters prioritize_critical_css
# Removes comments from HTML
# MODERATE RISK
ModPagespeedEnableFilters remove_comments
# This filter parses linked and inline CSS, rewrites the images found and minifies the CSS. The filter works on CSS found in <style> blocks and <
# link> refs.
# MODERATE RISK
ModPagespeedEnableFilters rewrite_css
# The "Rewrite Style Attributes" filter rewrites the CSS inside elements' style attributes as performed by rewrite_css, which includes CSS
# minification, image rewriting, image recompression, and cache extension, if enabled.
# LOW RISK
ModPagespeedEnableFilters rewrite_style_attributes
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment