Hello,
Playing around with pagespeed module, I found that it doesn't work over HTTPS in my case.
I have following configuration: 1st server for serving html, 2nd for serving assets.
Conf files looks like this:
1st:
server {
listen 80;
listen 443 ssl;
server_name dev.ru;
ssl_certificate MY_SELF_SIGNED_CERT;
ssl_certificate_key MY_SELF_SIGNED_CERT;
pagespeed on;
pagespeed FileCachePath ~some_path~/nginxTest/cache/pagespeed;
pagespeed Domain *-static.ru;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
pagespeed FetchHttps enable,allow_self_signed,allow_unknown_certificate_authority,allow_certificate_not_yet_valid;
root ~some_path~/nginxTest/;
charset utf-8;
location / {
index index.html;
}
}
2nd:
server {
listen 80;
listen 443 ssl;
server_name dev-static.ru;
ssl_certificate MY_SELF_SIGNED_CERT;
ssl_certificate_key MY_SELF_SIGNED_CERT;
root ~some_path~/nginxTest/;
charset utf-8;
pagespeed on;
pagespeed FileCachePath ~some_path~/nginxTest/cache/pagespeed-static;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
location /images/ {
try_files $uri =404;
}
}
html file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<img src="https://dev-static.ru/images/test_1.jpg" alt="">
</body>
</html>
With this configuration I only get optimized html, but not the image.
When I use HTTP (change protocol in html), all is working fine.
It also works with
but it is not an appropriate solution, since on production server there is only HTTPS available.