HTTPS Configuration
Configure HTTPS resource fetching in mod_pagespeed 1.1. FetchHttps with SSL certificates, MapOriginDomain to HTTP backend, and LoadFromFile.
mod_pagespeed fetches resources (CSS, JavaScript, images) from your site to optimize them. When your site serves pages over HTTPS, mod_pagespeed must be able to make HTTPS connections to fetch those resources.
Three approaches are available, from simplest to most flexible.
Approach 1: FetchHttps
The simplest option. mod_pagespeed fetches HTTPS resources directly using its built-in HTTP client.
pagespeed FetchHttps enable;
ModPagespeedFetchHttps enable
pagespeed FetchHttps enable
The 1.1 IIS module uses WinHTTP for HTTPS fetching. SSL certificate verification uses the Windows certificate store automatically — no SslCertDirectory or SslCertFile directives are needed.
By default, mod_pagespeed verifies SSL certificates. If certificate verification fails, configure the certificate directory or file explicitly:
pagespeed SslCertDirectory /etc/ssl/certs;
pagespeed SslCertFile /etc/ssl/certs/ca-certificates.crt;
ModPagespeedSslCertDirectory /etc/ssl/certs
ModPagespeedSslCertFile /etc/ssl/certs/ca-certificates.crt
Do not disable certificate verification in production. For development environments with self-signed certificates, set the certificate directory to the location of your self-signed CA.
Approach 2: MapOriginDomain with HTTP backend
If mod_pagespeed runs on the same server as the origin, map the HTTPS domain to a local HTTP backend:
pagespeed MapOriginDomain "http://localhost" "https://www.example.com";
ModPagespeedMapOriginDomain "http://localhost" "https://www.example.com"
pagespeed MapOriginDomain "http://localhost" "https://www.example.com"
This avoids HTTPS fetch overhead entirely. mod_pagespeed fetches from http://localhost instead of making an HTTPS connection to the public domain. The rewritten resource URLs still use https://www.example.com as seen by the browser.
Approach 3: LoadFromFile
Load resources directly from the filesystem, bypassing network fetches altogether:
pagespeed LoadFromFile "https://www.example.com/static/" "/var/www/static/";
ModPagespeedLoadFromFile "https://www.example.com/static/" "/var/www/static/"
pagespeed LoadFromFile "https://www.example.com/static/" "C:\inetpub\wwwroot\static\"
Note the Windows-style path. The module converts backslashes to forward slashes internally.
No network fetch occurs. mod_pagespeed reads the files from disk. This is the fastest option for static assets that are available on the local filesystem.
Mixed content
mod_pagespeed rewrites resource URLs to match the scheme of the page. Pages served over HTTPS will have their optimized resources served over HTTPS as well. This prevents mixed-content warnings in browsers.
See also
- Domain Configuration — domain authorization and mapping
- Configuration — general configuration reference