incubator-pagespeed-ngx icon indicating copy to clipboard operation
incubator-pagespeed-ngx copied to clipboard

Issue with HTTPS only page and noscript support and beacon are injected as http.

Open bigretromike opened this issue 3 years ago • 36 comments
trafficstars

My server serve pages via https (http/2) and redirect every http traffic to https. I had few issues but somehow resolve most of them:

  1. the <noscript><meta http-equiv=refresh content="0;url='**http**://redacted/?PageSpeed=noscript'"/>... that pagespeed included was HTTP instead of HTTPS, that was resolve via disabling adding code and add it manually. pagespeed SupportNoScriptEnabled false;
  2. the issue that I have now (I don't know if that's gonna be big issue or not) is that the beacon is added with http instead of http**s**. I tried rewriting beacon url but that append to value before /ngx_pagespeed_beacon and not the http://redacted part.
pagespeed.CriticalImages.Run('/ngx_pagespeed_beacon','http://redacted/','gLvPo-P25G',false,true,'zFnuPmTKJDs');

The beacon is hosted correctly and POST is send to correct endpoint but the url that is passed to it is with bad protocol (http instead of https) https://redacted/ngx_pagespeed_beacon?url=http://redacted/

I have:

pagespeed Domain https://redacted;
# pagespeed MapOriginDomain "https://redacted" "http://redacted";  # this one doesn't affect beacon so this one is turn off
pagespeed MapRewriteDomain "https://redacted" "http://redacted"
pagespeed LoadFromFile "https://redacted/wp-content/" "/var/www/wp-content/";
pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/";

sadly if I dont add LoadFromFile for http address my site break as it get error in console: # [Warning] [1502319] [image.webp:0] Resource based on http://redacted/wp-content/uploads/2022/07/image.webp but cannot access the original Also I see a lot http logs on pagespeed_admin console tab and im unsure if its hardcoded or HTTPS is not fully supported.

nginx 1.23 pagespeed 1.14.36.1-0

bigretromike avatar Jul 17 '22 11:07 bigretromike

pagespeed Domain https://redacted;
# pagespeed MapOriginDomain "https://redacted" "http://redacted";  # this one doesn't affect beacon so this one is turn off
pagespeed MapRewriteDomain "https://redacted" "http://redacted"
pagespeed LoadFromFile "https://redacted/wp-content/" "/var/www/wp-content/";
pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/";

Are these lines all the pagespeed config? Try to add some like:

pagespeed FetchHttps enable; pagespeed SslCertDirectory directory; (directory in Debian based normally is /etc/ssl/certs, Centos /etc/pki/tls/certs pagespeed SslCertFile file; (Only for Red-Hat/Centos distro /etc/pki/tls/cert.pem.)

Lofesa avatar Aug 11 '22 12:08 Lofesa

pagespeed Domain https://redacted;
# pagespeed MapOriginDomain "https://redacted" "http://redacted";  # this one doesn't affect beacon so this one is turn off
pagespeed MapRewriteDomain "https://redacted" "http://redacted"
pagespeed LoadFromFile "https://redacted/wp-content/" "/var/www/wp-content/";
pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/";

Are these lines all the pagespeed config? Try to add some like:

pagespeed FetchHttps enable; pagespeed SslCertDirectory directory; (directory in Debian based normally is /etc/ssl/certs, Centos /etc/pki/tls/certs pagespeed SslCertFile file; (Only for Red-Hat/Centos distro /etc/pki/tls/cert.pem.)

Yes, they are.

I have this in nginx.conf

        pagespeed FetchHttps enable;
        pagespeed SslCertDirectory /etc/ssl/certs;
        pagespeed FetcherTimeoutMs 10000;
        pagespeed NativeFetcherMaxKeepaliveRequests 50;
        pagespeed UseNativeFetcher off;         # use better fetcher
        resolver 127.0.0.1;                     # dns for fetrcher

bigretromike avatar Aug 19 '22 07:08 bigretromike

And you have a DNS server i 127.0.0.1? And I supose you are not using any proxy cache or load balancing, rigth?

Lofesa avatar Aug 19 '22 11:08 Lofesa

And you have a DNS server i 127.0.0.1? And I supose you are not using any proxy cache or load balancing, rigth?

You are correct 127.0.0.1 is auth dns server for domain that is used and it also resolved all other querys. Only proxy I use are the one build in nginx and php - I dont use proxy or load balancers on that server.

bigretromike avatar Aug 21 '22 00:08 bigretromike

Sorry for commig too late, but have personal issues that make me out of internet for some time.

The site runs in https, so why have you:

pagespeed MapRewriteDomain "https://redacted" "http://redacted"; pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/";

MapRewriteDomain makes any ocurrence of http://redacted is rewrited as https://redacted, but if the site runs w/o any proxy, ssl end point or similar thing, why you have http resources in an https page?

The error you have posted say this:

# [Warning] [1502319] [image.webp:0] Resource based on http://redacted/wp-content/uploads/2022/07/image.webp but cannot access the original

So pagespeed is searching for a http resource.

Lofesa avatar Sep 29 '22 10:09 Lofesa

Sorry for commig too late, but have personal issues that make me out of internet for some time.

The site runs in https, so why have you:

pagespeed MapRewriteDomain "https://redacted" "http://redacted"; pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/";

MapRewriteDomain makes any ocurrence of http://redacted is rewrited as https://redacted, but if the site runs w/o any proxy, ssl end point or similar thing, why you have http resources in an https page?

The error you have posted say this:

# [Warning] [1502319] [image.webp:0] Resource based on http://redacted/wp-content/uploads/2022/07/image.webp but cannot access the original

So pagespeed is searching for a http resource.

Thanks for replay, better than newer.

  1. pagespeed MapRewriteDomain "https://redacted/" "http://redacted/"; I added it was suggested on other forums to maybe "force" any http request to https - with or without there is no changes looks like I leave those uncommented.
  2. pagespeed LoadFromFile "http://redacted/wp-content/" "/var/www/wp-content/"; even if the page serve content thru https, the fallback to http made it tricky as it is same server for http/https content but I would prefer all traffic go thry https so I mapped http url location to local path, also another thing that I tested with and without, and this one cut a lot of errors. still did not resolve issue with https page getting called back by pagespeed thru http.
  3. Yes, page does run without proxy, the page runs fine on http also but it is servered via https without any content pointing to http (aka no mixed content)
  4. both https and http for redacted/wp-content/uploads/2022/07/image.webp is available.

bigretromike avatar Sep 30 '22 21:09 bigretromike

The problem seems that pagespeed don't see the https version .

Generally spoken having 2 version (http and https) of the same site is a bad idea. Search engines (google ammong others) may consider these pages are duplicate conted. The rigth way is having a 301 redirect from http to https version. Some like:

server { listen 80; server_name your-server-name.com return 301 https://$host$request_uri; } server { listen 443; server_name your-server-name.com; pagespeed on; here pagespeed directives . }

Lofesa avatar Oct 05 '22 10:10 Lofesa

Yes, I do have 301 redirection from http version to https. I also have www to non-www version 301 redirect.

 if ($host = www.redacted) {
                return 301 https://$host$request_uri;
        } # managed by Certbot


        if ($host = redacted) {
                return 301 https://$host$request_uri;
        } # managed by Certbot

also if https:// starts with www, its get redirected to https://non-www version:

 if ($host = www.redacted) {
                return 301 https://$host$request_uri;
        } # managed by Certbot

Still the issue is present. Imo with or without http version pagespeed should try to optimize the protocol that it was given. not the one he detects (or not) because any non-https traffic is 301 onto https thats why its a secret to my why he does anything on http.

bigretromike avatar Oct 06 '22 05:10 bigretromike

I comment out every MapRewriteDomain and LoadFromFile. I disabled:

pagespeed EnableFilters rewrite_domains;
pagespeed DomainRewriteHyperlinks on;
pagespeed LoadFromFileCacheTtlMs 3600000;  # 1h = 3600 000
pagespeed LoadFromFileRuleMatch disallow .*;
        pagespeed LoadFromFileRuleMatch allow \.css$;
        pagespeed LoadFromFileRuleMatch allow \.webp$;
        pagespeed LoadFromFileRuleMatch allow \.png$;
        pagespeed LoadFromFileRuleMatch allow \.jpg$;
        pagespeed LoadFromFileRuleMatch allow \.js$;

reloaded, yet still pagespeed try to parse http content even when every http request is redirected to https, I have no idea why.. maybe its bug in printing log ? [http://redacted/produkt/j0inya006m/:103] Unrecognized script:'<script type="text/template" id="tmpl-variation-template"></script> 103...107' when you paste http://redacted/produkt/j0inya006m/ to browser you get 301 to https://redacted/produkt/j0inya006m/

bigretromike avatar Oct 07 '22 21:10 bigretromike

[http://redacted/produkt/j0inya006m/:103] Unrecognized script:'<script type="text/template" id="tmpl-variation-template" 103...107' This has nothing to do qith the issue, Pagespeed only recognizes javascript, so anything in script tags no javascript is unrecognized

Can you try adding ?PageSpeedFilters=+debug to the request?

https://redacted/someàge/?PageSpeedFilters=+debug (NOTE: PageSpeedFilters is case sensitive, must be as you see here) Make some hits qith this parameter and then take a look at the hatml code. Debug messages appears as htmk comments.

Lofesa avatar Oct 09 '22 16:10 Lofesa

Welcome, once again im struggling with this issue, I didn't resolve it but now its even more anoying as I changed server, upgraded nginx, installed the latest and greatest pagespeed module, but still the issue is there. Different machine, different OS, different software version same issue.

I will be trying to resolve the issue this time and I will be posting updates with results here.

pagespeed FetchHttps enable; pagespeed SslCertDirectory directory; (directory in Debian based normally is /etc/ssl/certs, Centos /etc/pki/tls/certs pagespeed SslCertFile file; (Only for Red-Hat/Centos distro /etc/pki/tls/cert.pem.)

As I changed OS (to RHEL compatible) i added sslcert file, without any difference.

I tried adding pagespeed FetchHttps enable,allow_unkonow_certificate_authority,allow_self_signed,allow_certificate_not_yet_valide; without difference

If I add pagespeed MapRewriteDomain "https://mydomain.com" "http://mydomain.com" I get fewer errors in logs about not being able to fetch like this: [ngx_pagespeed 1.15.0.0-8917] [1202/103400:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/js/frontend-script.js,qver==2.0.2+webfont.js,qver==6.1.1.pagespeed.jc.-DJsi-JAKD.js Which is correct because I even disabled HTTP version of the page so I wont have issues because of that. But it shouldnt show up because mydomain.com is 100% https, not a single line of code/dynamic_code/static_code link to http content on the page. If I disable MapRewriteDomain, most of the images doesn't load as it tries to fetch them via http, yet the image is replaces with proper pagespeed link (that include .pagespeed. in name) but it does 404 - maybe im missing ngxin location route? The only one pointing to similar content is one located as the first location in mydomain.config file in nginx: location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; set $no_cache 1; }

Edit: Disabling pagespeed MapRewriteDomain "https://mydomain.com" "http://mydomain.com" and enabling pagespeed LoadFromFile "http://mydomain.com/wp-content/" "/var/www/web/wp-content/"; results is same behavior, which is ok because both are use to acomplished same thing, yet still pagespeed is trying to fetch data by http.

bigretromike avatar Dec 02 '22 11:12 bigretromike

Configuration from Admin Page

Version: 14: on

Filters
ah	Add Head
cw	Collapse Whitespace
cc	Combine Css
ch	Combine Heads
jc	Combine Javascript
gp	Convert Gif to Png
jp	Convert Jpeg to Progressive
jw	Convert Jpeg To Webp
mc	Convert Meta Tags
pj	Convert Png to Jpeg
ws	When converting images to WebP, prefer lossless conversions
dd	Dedup Inlined Images
di	Delay Images
ea	Elide Attributes
ec	Cache Extend Css
ei	Cache Extend Images
es	Cache Extend Scripts
fc	Fallback Rewrite Css 
if	Flatten CSS Imports
hw	Flushes html
ci	Inline Css
gf	Inline Google Font CSS
ii	Inline Images
il	Inline @import to Link
ji	Inline Javascript
id	Insert Image Dimensions
js	Jpeg Subsampling
ll	Lazyload Images
tu	Left Trim Urls
cj	Move Css Above Scripts
cm	Move Css To Head
co	Outline Css
pc	Add pedantic types
pr	Prioritize Critical Css
rj	Recompress Jpeg
rp	Recompress Png
rw	Recompress Webp
rq	Remove Quotes
ri	Resize Images
rm	Resize Mobile Images
ir	Resize to Rendered Image Dimensions
rx	Responsive Images
cf	Rewrite Css
jm	Rewrite External Javascript
jj	Rewrite Inline Javascript
cs	Rewrite Style Attributes
cu	Rewrite Style Attributes With Url
cp	Strip Image Color Profiles
md	Strip Image Meta Data

Options
  AdminPath (nap)                              /pagespeed_admin
  AvoidRenamingIntrospectiveJavascript (aris)  True
  BeaconUrl (bu)                               /ngx_pagespeed_beacon
  CacheFragment (ckp)                          ohayo-cache
  CombineAcrossPaths (cp)                      False
  CriticalImagesBeaconEnabled (cibe)           True
  DisableRewriteOnNoTransform (drnt)           False
  EnableCachePurge (euci)                      True
  EnableRewriting (e)                          1
  FetcherTimeOutMs (bfto)                      10000
  FetchHttps (fhs)                             enable,allow_unknown_certificate_authority,allow_self_signed,allow_certificate_not_yet_valid
  FileCacheCleanIntervalMs (afcci)             3600000
  FileCacheInodeLimit (afcl)                   500000
  FileCachePath (afcp)                         /run/nginx-pagespeed/
  FileCacheSizeKb (afc)                        102400
  HttpCacheCompressionLevel (hccl)             9
  ImageMaxRewritesAtOnce (im)                  3
  InPlaceResourceOptimization (ipro)           False
  LazyloadImagesAfterOnload (llio)             True
  LazyloadImagesBlankUrl (llbu)                https://www.gstatic.com/psa/static/1.gif
  LogDir (ald)                                 /var/log/pagespeed
  LRUCacheByteLimit (alcb)                     16384
  LRUCacheKbPerProcess (alcp)                  10240
  MaxCacheableContentLength (rcl)              16777216
  MaxCombinedCssBytes (xcc)                    92160
  MaxCombinedJsBytes (xcj)                     192160
  MaxSegmentLength (uss)                       250
  MemcachedServers (ams)                       127.0.0.1:11211
  MemcachedThreads (amt)                       1
  MemcachedTimeoutUs (amo)                     1000000
  RewriteLevel (l)                             Core Filters
  SslCertDirectory (assld)                     /etc/pki/tls/certs
  SslCertFile (asslf)                          /etc/pki/tls/cert.pem
  Statistics (ase)                             True
  StatisticsLogging (asle)                     True
  StatisticsLoggingIntervalMs (asli)           60000
  StatisticsLoggingMaxFileSizeKb (aslfs)       1024
  StatisticsPath (nsp)                         /nxg_stat
  SupportNoScriptEnabled (snse)                False
  UseExperimentalJsMinifier (uejsm)            True

Domain Lawyer
  https://mydomain.com/ Auth

Invalidation Timestamp: Fri, 02 Dec 2022 09:27:24 GMT (1669973244968)

page with debug parameter:

<!--
mod_pagespeed on
Filters:
ah	Add Head
cw	Collapse Whitespace
cc	Combine Css
ch	Combine Heads
jc	Combine Javascript
gp	Convert Gif to Png
jp	Convert Jpeg to Progressive
jw	Convert Jpeg To Webp
mc	Convert Meta Tags
pj	Convert Png to Jpeg
ws	When converting images to WebP, prefer lossless conversions
db	Debug
dd	Dedup Inlined Images
di	Delay Images
ea	Elide Attributes
ec	Cache Extend Css
ei	Cache Extend Images
es	Cache Extend Scripts
fc	Fallback Rewrite Css 
if	Flatten CSS Imports
hw	Flushes html
ci	Inline Css
gf	Inline Google Font CSS
ii	Inline Images
il	Inline @import to Link
ji	Inline Javascript
id	Insert Image Dimensions
js	Jpeg Subsampling
ll	Lazyload Images
tu	Left Trim Urls
cj	Move Css Above Scripts
cm	Move Css To Head
co	Outline Css
pc	Add pedantic types
pr	Prioritize Critical Css
rj	Recompress Jpeg
rp	Recompress Png
rw	Recompress Webp
rq	Remove Quotes
ri	Resize Images
rm	Resize Mobile Images
ir	Resize to Rendered Image Dimensions
rx	Responsive Images
cf	Rewrite Css
jm	Rewrite External Javascript
jj	Rewrite Inline Javascript
cs	Rewrite Style Attributes
cu	Rewrite Style Attributes With Url
cp	Strip Image Color Profiles
md	Strip Image Meta Data

Options:
AvoidRenamingIntrospectiveJavascript (aris) True
CombineAcrossPaths (cp) False
CriticalImagesBeaconEnabled (cibe) True
DisableRewriteOnNoTransform (drnt) False
EnableCachePurge (euci) True
EnableRewriting (e) 1
FetcherTimeOutMs (bfto) 10000
FileCacheCleanIntervalMs (afcci) 3600000
FileCacheInodeLimit (afcl) 500000
FileCacheSizeKb (afc) 102400
HttpCacheCompressionLevel (hccl) 9
ImageMaxRewritesAtOnce (im) 3
InPlaceResourceOptimization (ipro) False
LazyloadImagesAfterOnload (llio) True
LazyloadImagesBlankUrl (llbu) https://www.gstatic.com/psa/static/1.gif
LRUCacheByteLimit (alcb) 16384
LRUCacheKbPerProcess (alcp) 10240
MaxCacheableContentLength (rcl) 16777216
MaxCombinedCssBytes (xcc) 92160
MaxCombinedJsBytes (xcj) 192160
MaxSegmentLength (uss) 250
MemcachedThreads (amt) 1
MemcachedTimeoutUs (amo) 1000000
RewriteLevel (l) Core Filters
Statistics (ase) True
StatisticsLogging (asle) True
StatisticsLoggingIntervalMs (asli) 60000
SupportNoScriptEnabled (snse) False
UseExperimentalJsMinifier (uejsm) True

#NumFlushes            0
#EndDocument after     12874us
#Total Parse duration  2699us
#Total Render duration 61599us
#Total Idle duration   10175us
No critical images detected.
The following filters were disabled for this request:
	CriticalSelectorFilter: No critical selector info in cache
	DelayImages
	Lazyload Images
-->

And nginx log contains those:

2022/12/02 11:29:56 [warn] 210834#210876: [ngx_pagespeed 1.15.0.0-8917] [1202/112956:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/css/dist/block-library/A.style.min.css,qver=6.1.1.pagespeed.cf.s5bSa4kM1r.css
2022/12/02 11:29:56 [warn] 210834#210876: [ngx_pagespeed 1.15.0.0-8917] [1202/112956:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/jquery/jquery-migrate.min.js,qver=3.3.2.pagespeed.jm.Ws-UgblvVg.js
2022/12/02 11:29:56 [warn] 210834#210877: [ngx_pagespeed 1.15.0.0-8917] [1202/112956:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/underscore.min.js,qver=1.13.4.pagespeed.jm.-wWaxZbynX.js

bigretromike avatar Dec 02 '22 11:12 bigretromike

After commenting out LoadFromFile random number of images won't show up and page

<!--
mod_pagespeed on
Filters:
ah	Add Head
cw	Collapse Whitespace
cc	Combine Css
ch	Combine Heads
jc	Combine Javascript
gp	Convert Gif to Png
jp	Convert Jpeg to Progressive
jw	Convert Jpeg To Webp
mc	Convert Meta Tags
pj	Convert Png to Jpeg
ws	When converting images to WebP, prefer lossless conversions
db	Debug
dd	Dedup Inlined Images
di	Delay Images
ea	Elide Attributes
ec	Cache Extend Css
ei	Cache Extend Images
es	Cache Extend Scripts
fc	Fallback Rewrite Css 
if	Flatten CSS Imports
hw	Flushes html
ci	Inline Css
gf	Inline Google Font CSS
ii	Inline Images
il	Inline @import to Link
ji	Inline Javascript
id	Insert Image Dimensions
js	Jpeg Subsampling
ll	Lazyload Images
tu	Left Trim Urls
cj	Move Css Above Scripts
cm	Move Css To Head
co	Outline Css
pc	Add pedantic types
pr	Prioritize Critical Css
rj	Recompress Jpeg
rp	Recompress Png
rw	Recompress Webp
rq	Remove Quotes
ri	Resize Images
rm	Resize Mobile Images
ir	Resize to Rendered Image Dimensions
rx	Responsive Images
cf	Rewrite Css
jm	Rewrite External Javascript
jj	Rewrite Inline Javascript
cs	Rewrite Style Attributes
cu	Rewrite Style Attributes With Url
cp	Strip Image Color Profiles
md	Strip Image Meta Data

Options:
AvoidRenamingIntrospectiveJavascript (aris) True
CombineAcrossPaths (cp) False
CriticalImagesBeaconEnabled (cibe) True
DisableRewriteOnNoTransform (drnt) False
EnableCachePurge (euci) True
EnableRewriting (e) 1
FetcherTimeOutMs (bfto) 10000
FileCacheCleanIntervalMs (afcci) 3600000
FileCacheInodeLimit (afcl) 500000
FileCacheSizeKb (afc) 102400
HttpCacheCompressionLevel (hccl) 9
ImageMaxRewritesAtOnce (im) 3
InPlaceResourceOptimization (ipro) False
LazyloadImagesAfterOnload (llio) True
LazyloadImagesBlankUrl (llbu) https://www.gstatic.com/psa/static/1.gif
LRUCacheByteLimit (alcb) 16384
LRUCacheKbPerProcess (alcp) 10240
MaxCacheableContentLength (rcl) 16777216
MaxCombinedCssBytes (xcc) 92160
MaxCombinedJsBytes (xcj) 192160
MaxSegmentLength (uss) 250
MemcachedThreads (amt) 1
MemcachedTimeoutUs (amo) 1000000
RewriteLevel (l) Core Filters
Statistics (ase) True
StatisticsLogging (asle) True
StatisticsLoggingIntervalMs (asli) 60000
SupportNoScriptEnabled (snse) False
UseExperimentalJsMinifier (uejsm) True

#NumFlushes            0
#EndDocument after     14491us
#Total Parse duration  3370us
#Total Render duration 50307us
#Total Idle duration   11121us
Critical Images:
	data:image/svg+xml;base64,PHN223<redacted>==
	data:image/svg+xml;base64,PHN2Zy<redacted>==
	data:image/svg+xml;base64,PHN2Pg<redacted>==
	http://mydomain.com/wp-content/uploads/slider/cache/f3c95aed3bef34293901d9e8fe70a1/baner_new-1.webp
	https://mydomain.com/wp-content/uploads/2021/02/000-300x300.jpg
	https://mydomain.com/wp-content/uploads/2021/02/003-300x300.jpg
	https://mydomain.com/wp-content/uploads/2021/02/kny_001-300x300.jpg
	https://mydomain.com/wp-content/uploads/2021/02/kny_002-300x300.jpg
	https://mydomain.com/wp-content/uploads/2021/04/sk8_010-300x300.jpg
	https://mydomain.com/wp-content/uploads/2021/06/bf_001-300x300.jpg
The following filters were disabled for this request:
	CriticalSelectorFilter: No critical selector info in cache
-->

Notice the http in there ^, also the nginx log got those warrnings:

2022/12/02 11:25:13 [warn] 210590#210635: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/pay-by-paynow-pl/assets/css/A.front.css,qver=2.4.10.pagespeed.cf.gza2uH-eND.css
2022/12/02 11:25:13 [warn] 210590#210635: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/A.frontend-style.css,qver=2.0.2.pagespeed.cf.w63jaWGSEN.css
2022/12/02 11:25:13 [warn] 210590#210635: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/A.genericons.css,qver=6.1.1.pagespeed.cf.MrUO0k-k7u.css
2022/12/02 11:25:13 [warn] 210590#210635: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/font-awesome/A.font-awesome.min.css,qver=6.1.1.pagespeed.cf.nrOL480BpE.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/A.linear-icon-font.min.css,,qver==6.1.1+jquery.mCustomScrollbar.css,,qver==2.0.2,Mcc.0QxnMDf5Xg.css.pagespeed.cf.xNaISPEV5w.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/themes/shoptimizer/A.style.css,qver=2.6.2.pagespeed.cf.1B2M2Y8Asg.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/themes/shoptimizer-child-theme/A.style.css,qver=1.2.1.pagespeed.cf.1B2M2Y8Asg.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/themes/shoptimizer/assets/css/main/modal.min.css,qver==2.6.2+blocks.min.css,qver==2.6.2.pagespeed.cc.xqWx8SYpYG.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/newsletter/A.style.css,qver=7.5.6.pagespeed.cf.wVC97_uOK5.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/woocommerce-product-bundles/assets/css/frontend/A.checkout-blocks.css,qver=6.16.1.pagespeed.cf.W7pkChSUkO.css
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/jquery/jquery-migrate.min.js,qver=3.3.2.pagespeed.jm.Ws-UgblvVg.js
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/js/frontend-script.js,qver==2.0.2+webfont.js,qver==6.1.1+json2validation.js,qver==6.1.1+jquery.mCustomScrollbar.js,qver==2.0.2.pagespeed.jc.nXwcx6MHRI.js
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/commercegurus-commercekit/assets/js/popper.min.js,qver==2.1.1+tippy-bundle.umd.min.js,qver==2.1.1.pagespeed.jc._X-YPIn7qA.js
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/underscore.min.js,qver=1.13.4.pagespeed.jm.-wWaxZbynX.js
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/plugins/woocommerce/assets/js/jquery-blockui/jquery.blockUI.min.js,qver=2.7.0-wc.7.1.0.pagespeed.jm.BkSKjHCA_f.js
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/xKaguya-sama_-_Love_is_War_Logo.svg_.png.pagespeed.ic.EHH1d5lnEj.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/ya-boy-kongming-2022-removebg-preview2.png.pagespeed.ce.Mpvkw33spF.png
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xlogo-ohayo.png.pagespeed.ic.7QuIWVYmW3.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xkny_002-300x300.jpg.pagespeed.ic.0qFk73ZsGK.webp
2022/12/02 11:25:13 [warn] 210590#210635: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/x003-300x300.jpg.pagespeed.ic.R1ZzOEIPP3.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xkny_001-300x300.jpg.pagespeed.ic.P07IWhdmyv.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/xSite-logo.webp.pagespeed.ic.335ualXY1v.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/04/xnge_194-300x300.jpg.pagespeed.ic.fKgvYUQPeB.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xaot_085-300x300.jpg.pagespeed.ic.Kxu7QOtFcp.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xlogo-ohayo.png.pagespeed.ic.7QuIWVYmW3.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/xSite-logo.webp.pagespeed.ic.335ualXY1v.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/04/xnge_194-300x300.jpg.pagespeed.ic.fKgvYUQPeB.webp
2022/12/02 11:25:13 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112513:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/02/xaot_085-300x300.jpg.pagespeed.ic.Kxu7QOtFcp.webp
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/berserk_manga2.png.pagespeed.ce.-dIcO4TxJW.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/aot_manga.png.pagespeed.ce.Bb-IKWZ0U7.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/tpn_manga.png.pagespeed.ce.6MsDBu2WZ3.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/assasin_manga.png.pagespeed.ce.rzexGBx_kf.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/f_logo_RGB-Blue_58.png.pagespeed.ce.Tt6-UOAyLZ.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/Instagram_Glyph_Gradient_RGB.png.pagespeed.ce.r6yESK7HBL.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/2021-Twitter-logo-blue.png.pagespeed.ce.dXHqExedBt.png
2022/12/02 11:25:14 [warn] 210590#210638: [ngx_pagespeed 1.15.0.0-8917] [1202/112514:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/08/xgim_001-300x300.jpg.pagespeed.ic.0L-n56JpPJ.webp

bigretromike avatar Dec 02 '22 11:12 bigretromike

A question... How the resources are wruten in the html code? some like src=//mydomain/myimge or src=https://mydomain/myimage ?

Also why this?: (Note 1 image have http and others have https)

Critical Images: data:image/svg+xml;base64,PHN223== data:image/svg+xml;base64,PHN2Zy== data:image/svg+xml;base64,PHN2Pg== http://mydomain.com/wp-content/uploads/slider/cache/f3c95aed3bef34293901d9e8fe70a1/baner_new-1.webp https://mydomain.com/wp-content/uploads/2021/02/000-300x300.jpg

Lofesa avatar Dec 02 '22 12:12 Lofesa

A question... How the resources are wruten in the html code? some like src=//mydomain/myimge or src=https://mydomain/myimage ?

Also why this?: (Note 1 image have http and others have https)

Critical Images: data:image/svg+xml;base64,PHN223== data:image/svg+xml;base64,PHN2Zy== data:image/svg+xml;base64,PHN2Pg== http://mydomain.com/wp-content/uploads/slider/cache/f3c95aed3bef34293901d9e8fe70a1/baner_new-1.webp https://mydomain.com/wp-content/uploads/2021/02/000-300x300.jpg

I know ! And have no clue why pagespeed does that ! Every link contains schema https://mydomain.com/.....

Also now its also included:

<!--Summary computation status for CriticalCssBeacon
Resource 0 http://mydomain.com/:46: Computed OK
Resource 1 https://mydomain.com/wp-content/plugins/woocommerce-points-and-rewards/build/style-index.css?ver=1.7.18: Computed OK
Resource 2 https://mydomain.com/wp-includes/css/dist/block-library/style.min.css?ver=6.1.1: Computed OK
Resource 3 https://mydomain.com/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-vendors-style.css?ver=8.7.5: Computed OK
Resource 4 https://mydomain.com/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-style.css?ver=8.7.5: Computed OK
Resource 5 http://mydomain.com/:64: Computed OK
Resource 6 https://mydomain.com/wp-includes/css/classic-themes.min.css?ver=1: Computed OK
Resource 7 http://mydomain.com/:69: Computed OK
Resource 8 https://mydomain.com/wp-content/plugins/pay-by-paynow-pl/assets/css/front.css?ver=2.4.10: Computed OK
Resource 9 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/frontend-style.css?ver=2.0.2: Computed OK
Resource 10 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/genericons.css?ver=6.1.1: Computed OK
Resource 11 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/font-awesome/font-awesome.min.css?ver=6.1.1: Computed OK
Resource 12 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/rtl_styles.css?ver=6.1.1: Fetch failed or resource not publicly cacheable
Resource 13 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/linear-icon-font.min.css?ver=6.1.1: Computed OK
Resource 14 https://mydomain.com/wp-content/plugins/total-gdpr-compliance/assets/css/jquery.mCustomScrollbar.css?ver=2.0.2: Resource removed by another filter
Resource 15 http://mydomain.com/:82: Computed OK
Resource 16 https://mydomain.com/wp-content/plugins/woocommerce-brands/assets/css/style.css?ver=1.6.38: Computed OK
Resource 17 https://mydomain.com/wp-content/plugins/yith-infinite-scrolling/assets/css/frontend.css?ver=1.8.0: Computed OK
Resource 18 https://mydomain.com/wp-content/themes/shoptimizer/style.css?ver=2.6.2: Computed OK
Resource 19 https://mydomain.com/wp-content/themes/shoptimizer-child-theme/style.css?ver=1.2.1: Computed OK
Resource 20 https://mydomain.com/wp-content/themes/shoptimizer/assets/css/main/main.min.css?ver=2.6.2: Computed OK
Resource 21 https://mydomain.com/wp-content/themes/shoptimizer/assets/css/main/modal.min.css?ver=2.6.2: Computed OK
Resource 22 https://mydomain.com/wp-content/themes/shoptimizer/assets/css/main/blocks.min.css?ver=2.6.2: Resource removed by another filter
Resource 23 https://mydomain.com/wp-content/plugins/newsletter/style.css?ver=7.5.6: Computed OK
Resource 24 https://mydomain.com/wp-content/plugins/woocommerce-product-bundles/assets/css/frontend/checkout-blocks.css?ver=6.16.1: Computed OK
Resource 25 https://mydomain.com/wp-content/plugins/woocommerce-waitlist/includes/css/src/wcwl_frontend.min.css?ver=2.3.0: Computed OK
Resource 26 https://mydomain.com/wp-content/themes/shoptimizer/assets/css/main/woocommerce.min.css?ver=2.6.2: Computed OK
Resource 27 https://mydomain.com/wp-content/plugins/woocommerce-product-bundles/assets/css/frontend/woocommerce.css?ver=6.16.1: Computed OK
Resource 28 https://mydomain.com/wp-content/plugins/smart-slider-3/Public/SmartSlider3/Application/Frontend/Assets/dist/smartslider.min.css?ver=23139749: Cannot create resource: either its domain is unauthorized and InlineUnauthorizedResources is not enabled, or it cannot be fetched (check the server logs)
Resource 29 http://mydomain.com/:107: Computed OK
Resource 30 http://mydomain.com/:125: Computed OK
Resource 31 http://mydomain.com/:178: Computed OK
Resource 32 http://mydomain.com/:319: Computed OK
-->

As you see it reads main domain/page as http:// even when there is no explicid configuration for http version (there is currently only one page configured on this server which is mydomain.com on port 443 with ssl enabled)

bigretromike avatar Dec 02 '22 12:12 bigretromike

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; set $no_cache 1; }

Can you try: location ~ ^.pagespeed/ { add_header "" ""; set $no_cache 1; }

For my wordpress instances I use the plugin "SSL Insecure Content Fixer", it rewrites all output links to https. The problem might be somewhere in your mysql database but installing this plugin should fix this easier.

eilandert avatar Dec 02 '22 12:12 eilandert

A question... How the resources are wruten in the html code? some like src=//mydomain/myimge or src=https://mydomain/myimage ?

Also why this?: (Note 1 image have http and others have https)

Critical Images: data:image/svg+xml;base64,PHN223== data:image/svg+xml;base64,PHN2Zy== data:image/svg+xml;base64,PHN2Pg== http://mydomain.com/wp-content/uploads/slider/cache/f3c95aed3bef34293901d9e8fe70a1/baner_new-1.webp https://mydomain.com/wp-content/uploads/2021/02/000-300x300.jpg

I found that images added to slider are added like this <img src="//mydomain.com/wp-content/uploads/2022/06/baner_new-1.webp" alt="" title="" loading="lazy" class="skip-lazy" data-skip-lazy="1">

bigretromike avatar Dec 02 '22 12:12 bigretromike

@eilandert

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; set $no_cache 1; }

Can you try: location ~ ^.pagespeed/ { add_header "" ""; set $no_cache 1; }

For my wordpress instances I use the plugin "SSL Insecure Content Fixer", it rewrites all output links to https. The problem might be somewhere in your mysql database but installing this plugin should fix this easier.

Should I remove old one? because I added yours next to old one, and no difference.

@Lofesa I replace scr to image to absolut path with https still I see that main page is fetched via http :/

bigretromike avatar Dec 02 '22 12:12 bigretromike

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; set $no_cache 1; }

Can you try: location ~ ^.pagespeed/ { add_header "" ""; set $no_cache 1; }

For my wordpress instances I use the plugin "SSL Insecure Content Fixer", it rewrites all output links to https. The problem might be somewhere in your mysql database but installing this plugin should fix this easier.

I installed SSL Insecure Content Fixer but that does nothing for me - the page is SSL compatible with Green shield on all browsers.

bigretromike avatar Dec 02 '22 12:12 bigretromike

PageSpeed console still show:

http://mydomain.com/:1196: Resized image `https://mydomain.com/wp-content/uploads/2021/04/dgr_001-300x300.jpg' from 300x300 to 237x237
[Fri, 02 Dec 2022 12:52:39 GMT] [Info] [214422] [http://mydomain.com/seria/healin-good-pretty-cure/page/2/:89] Unrecognized script:'<script type="text/template" id="tmpl-variation-template"></script> 89...93'
[Fri, 02 Dec 2022 12:53:35 GMT] [Warning] [214424] [underscore.min.js,qver=1.13.4:0] Resource based on http://mydomain.com/wp-includes/js/underscore.min.js?ver=1.13.4 but cannot access the original
[Fri, 02 Dec 2022 12:53:36 GMT] [Warning] [214424] [A.classic-themes.min.css,qver=1:0] Resource based on http://mydomain.com/wp-includes/css/classic-themes.min.css?ver=1 but cannot access the original

nginx log:

2022/12/02 12:55:12 [warn] 214423#214480: [ngx_pagespeed 1.15.0.0-8917] [1202/125512:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/jquery/jquery-migrate.min.js,qver=3.3.2.pagespeed.jm.Ws-UgblvVg.js
2022/12/02 12:55:12 [warn] 214423#214477: [ngx_pagespeed 1.15.0.0-8917] [1202/125512:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/js/underscore.min.js,qver=1.13.4.pagespeed.jm.-wWaxZbynX.js
2022/12/02 12:55:12 [warn] 214423#214480: [ngx_pagespeed 1.15.0.0-8917] [1202/125512:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/css/dist/block-library/A.style.min.css,qver=6.1.1.pagespeed.cf.s5bSa4kM1r.css
2022/12/02 12:55:12 [warn] 214423#214480: [ngx_pagespeed 1.15.0.0-8917] [1202/125512:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-includes/css/A.classic-themes.min.css,qver=1.pagespeed.cf.wMG3qLFv9v.css

And I don't think that http is hardcoded in logs

And this results in unable to load those JS files and console throw 404: https://mydomain.com/wp-includes/js/jquery/jquery-migrate.min.js,qver=3.3.2.pagespeed.jm.Ws-UgblvVg.js https://mydomain.com/wp-includes/js/underscore.min.js,qver=1.13.4.pagespeed.jm.-wWaxZbynX.js https://mydomain.com/wp-includes/css/dist/block-library/A.style.min.css,qver=6.1.1.pagespeed.cf.s5bSa4kM1r.css https://mydomain.com/wp-includes/css/A.classic-themes.min.css,qver=1.pagespeed.cf.wMG3qLFv9v.css

Edit: Disabling pagespeed reveals the way those files are added to code: <script type='text/javascript' src='https://mydomain.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script> <script type='text/javascript' src='https://mydomain.com/wp-includes/js/underscore.min.js?ver=1.13.4' id='underscore-js'></script> <link rel='stylesheet' id='classic-theme-styles-css' href='https://mydomain.com/wp-includes/css/classic-themes.min.css?ver=1' type='text/css' media='all' />

bigretromike avatar Dec 02 '22 13:12 bigretromike

disabling pagespeed LoadFromFile "https://mydomain.com/wp-content" "/var/www/web/wp-content"; results in nginx log with: Fetch failed for resource url http://mydomain.com/wp-content/uploads/............. and not images on page

Currently I have no idea why pagespeed trying so hard to optimize http content when page is https

bigretromike avatar Dec 02 '22 13:12 bigretromike

What do you see in the logs files about this with debug enabled? https://mydomain.com/wp-content/plugins/smart-slider-3/Public/SmartSlider3/Application/Frontend/Assets/dist/smartslider.min.css?ver=23139749

in the <!--Summary computation status for CriticalCssBeacon the message says:

Cannot create resource: either its domain is unauthorized and InlineUnauthorizedResources is not enabled, or it cannot be fetched (check the server logs)

In other hand, have you tried some like this add_header Content-Security-Policy upgrade-insecure-requests; ?

Lofesa avatar Dec 02 '22 14:12 Lofesa

What do you see in the logs files about this with debug enabled? https://mydomain.com/wp-content/plugins/smart-slider-3/Public/SmartSlider3/Application/Frontend/Assets/dist/smartslider.min.css?ver=23139749

in the <!--Summary computation status for CriticalCssBeacon the message says:

Cannot create resource: either its domain is unauthorized and InlineUnauthorizedResources is not enabled, or it cannot be fetched (check the server logs)

In other hand, have you tried some like this add_header Content-Security-Policy upgrade-insecure-requests; ?

smartslider is excluded from pagespeed because of the compatibility issues, I have done it via:

        # disable minify etc...
        pagespeed Allow "*";
        pagespeed Disallow "*.svg*";
        pagespeed Disallow "*.php*";
        pagespeed Allow "*.js*";
        pagespeed Allow "*.js?ver=*";
        pagespeed Allow "*.css*";
        pagespeed Allow "*.css?ver=*";
        pagespeed Allow "/wp-content/plugins/*";
        pagespeed Disallow "https://mydomain.com/*.pagespeed.*.js";
        pagespeed Disallow "*/js/jquery/jquery.js*";
        pagespeed Disallow "*/js/jquery/jquery.min.js*";
        pagespeed Disallow "*/wp-content/plugins/smart-slider-3/*";
        pagespeed Disallow "*/seal.js*";
        pagespeed Disallow "*/kirki/modules/webfont-loader/vendor-typekit/webfontloader.js*";
        pagespeed Disallow "*/wp-includes/js/dist/*";
        pagespeed Disallow "*/wp-includes/js/tinymce/*";
        # disable minify css
        pagespeed Disallow "*/wp-content/cache/*";
        pagespeed Disallow "*/wp-content/uploads/*";
        pagespeed Allow "*/wp-content/uploads/2021/*";
        pagespeed Allow "*/wp-content/uploads/2022/*";
        pagespeed Allow "*/wp-content/uploads/2023/*";
        pagespeed Disallow "*/admin-bar.min.css*";
        pagespeed Disallow "*/dashicons.min.css*";
        pagespeed Disallow "/wp-admin*";
        pagespeed Disallow "/wp-login.php*";
        pagespeed Disallow "/admin/*";

bigretromike avatar Dec 02 '22 15:12 bigretromike

One thing that comes to mind, I had the same problem once. I assume you are using php-fpm with fastcgi.

I remember vaguely that I had to explicitly force https, in the nginx vhost, fastcgi_param HTTPS on

eilandert avatar Dec 02 '22 15:12 eilandert

smartslider is excluded from pagespeed because of the compatibility issues, I have done it via:

   # disable minify etc...
  pagespeed Allow "*";

A bunch of things here.

    pagespeed Disallow "*.svg*";
    pagespeed Disallow "*.php*";

Not needed, because pahespeed mudules does nothing with these files.

    pagespeed Allow "*.js*";
    pagespeed Allow "*.js?ver=*";
    pagespeed Allow "*.css*";
    pagespeed Allow "*.css?ver=*";

Those with "ver=" are not needed because they are covered with ".js"; and ".css"; And the ? character must be scaped if used, in the regex , iy matches 1 character.

Deom the docs:

"Note: Wildcards include * which matches any 0 or more characters, and ?, which matches exactly one character. Unlike Unix shells, the / directory separator is not special, and can be matched by either * or ?. The resources are always expanded into their absolute form before expanding.

Note: The wildcard will be matched against the full URL including any query parameters. For example, if you want to match URL http://example.com/index.jsp?test=xyz you could use"

And take care with the order of these directives, order matter

"The later directives take priority over the earlier ones"

Lofesa avatar Dec 02 '22 18:12 Lofesa

One thing that comes to mind, I had the same problem once. I assume you are using php-fpm with fastcgi.

I remember vaguely that I had to explicitly force https, in the nginx vhost, fastcgi_param HTTPS on

replacing fastcgi_parm HTTPS $https if_not_empty; with fastcgi_param HTTPS on; give no difference

bigretromike avatar Dec 02 '22 19:12 bigretromike

I'm trying to make it not work with minimal setup;

http {
pagespeed on;
pagespeed PreserveUrlRelativity on;
pagespeed Statistics on;
pagespeed StatisticsLogging on;
pagespeed StatisticsLoggingIntervalMs 60000;
pagespeed StatisticsLoggingMaxFileSizeKb 1024;
pagespeed LogDir /var/log/pagespeed;
pagespeed AdminPath /pagespeed_admin;
pagespeed StatisticsPath /nxg_nekomata;
pagespeed FileCacheSizeKb            102400;
pagespeed FileCacheCleanIntervalMs   3600000;
pagespeed FileCacheInodeLimit        500000;
pagespeed LRUCacheKbPerProcess     10240;
pagespeed LRUCacheByteLimit        16384;
pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "127.0.0.1:11211";
pagespeed MemcachedTimeoutUs 1000000; 
pagespeed RewriteLevel CoreFilters;
pagespeed UsePerVhostStatistics on;
pagespeed EnableFilters debug; 
pagespeed MessageBufferSize 100000;
pagespeed RewriteLevel OptimizeForBandwidth;
pagespeed HttpCacheCompressionLevel 9; 
pagespeed InPlaceResourceOptimization off;  
pagespeed CacheFragment web-cache-fragment;
pagespeed LogDir "/var/log/pagespeed";
pagespeed CreateSharedMemoryMetadataCache "/var/www/web/mod_pagespeed/" 1024000;
pagespeed NumRewriteThreads 6;
pagespeed ImageMaxRewritesAtOnce 3;
pagespeed EnableCachePurge on;
pagespeed ListOutstandingUrlsOnError on;
pagespeed Domain https://mydomain.com;
server {
pagespeed FileCachePath /run/nginx-pagespeed-web;
pagespeed FetchHttps enable,allow_unknown_certificate_authority,allow_self_signed,allow_certificate_not_yet_valid;
pagespeed SslCertDirectory /etc/pki/tls/certs;
pagespeed SslCertFile /etc/pki/tls/cert.pem;
pagespeed FetcherTimeoutMs 10000;
pagespeed AddResourceHeader "x-content-type-options" "nosniff";
pagespeed Allow "*";
pagespeed Disallow "*/wp-includes/js/wp-util.js*";
pagespeed Disallow "https://mydomain.com/*.pagespeed.*.js";
pagespeed Disallow "*/js/jquery/jquery.js*";
pagespeed Disallow "*/js/jquery/jquery.min.js*";
pagespeed Disallow "*/wp-content/plugins/smart-slider-3/*";
pagespeed Disallow "*/seal.js";
pagespeed Disallow "*/kirki/modules/webfont-loader/vendor-typekit/webfontloader.js";
pagespeed Disallow "*/wp-includes/js/dist/*";
pagespeed Disallow "*/wp-includes/js/tinymce/*";
pagespeed Disallow "*/wp-content/plugins/wc-poczta/*";
pagespeed Disallow "*/wp-content/cache/*";
pagespeed Disallow "*/wp-content/uploads/*";
pagespeed Allow "*/wp-content/uploads/2021/*";
pagespeed Allow "*/wp-content/uploads/2022/*";
pagespeed Allow "*/wp-content/uploads/2023/*";
pagespeed Disallow "*/admin-bar.min.css";
pagespeed Disallow "*/dashicons.min.css";
pagespeed Disallow "/wp-admin/*";
pagespeed InPlaceResourceOptimization off;

pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed ConsolePath /pagespeed_console;
pagespeed AdminPath /pagespeed_admin;
pagespeed EnableFilters rewrite_javascript;             # minify js

Console say: I[Fri, 02 Dec 2022 21:31:45 GMT] [Info] [231995] HTTPCache key=http://mydomain.com/wp-content/uploads/2022/06/aot_manga.png fragment=web-cache-fragment: remembering recent failure for 119 seconds. W[Fri, 02 Dec 2022 21:31:45 GMT] [Warning] [231995] [xaot_manga.png:0] Resource based on http://mydomain.com/wp-content/uploads/2022/06/aot_manga.png but cannot access the original http://mydomain.com/produkt/op_080/:1131 srcset entry for 32w: Shrinking image https://mydomain.com/wp-content/uploads/2021/03/op_079-32x32.jpg' (5709 bytes) to https://mydomain.com/wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp' (612 bytes) Log say: [ngx_pagespeed 1.15.0.0-8917] [1202/213145:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2022/06/xaot_manga.png.pagespeed.ic.2j0w7-EoG1.png [ngx_pagespeed 1.15.0.0-8917] [1202/214113:WARNING:resource_fetch.cc(197)] Fetch failed for resource url http://mydomain.com/wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp [ngx_pagespeed 1.15.0.0-8917] xop_079-32x32.jpg:0:Resource based on http://mydomain.com/wp-content/uploads/2021/03/op_079-32x32.jpg but cannot access the original

Also I added rewrite_log on; and i'm trying to debug path that is picked from all my location, but i'm not sure why its not finished:

2022/12/02 21:32:45 [info] 231995#232019: [ngx_pagespeed 1.15.0.0-8917] http://mydomain.com/produkt/op_080/:1131 srcset entry for 32w: Shrinking image `https://mydomain.com/wp-content/uploads/2021/03/op_079-32x32.jpg' (5709 bytes) to `https://mydomain.com/wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp' (612 bytes)
2022/12/02 21:41:13 [notice] 231997#231997: *340 "^https://(mydomain\.com|cdn\.mydomain\.com)$" does not match "", client: my.external.ip.address, server: mydomain.com, request: "GET /wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp HTTP/2.0", host: "mydomain.com"
2022/12/02 21:41:13 [notice] 231997#231997: *340 "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)" does not match "/wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp", client: my.external.ip.address, server: mydomain.com, request: "GET /wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp HTTP/2.0", host: "mydomain.com"
2022/12/02 21:41:13 [notice] 231997#231997: *340 "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in" does not match "sockem_cookie=bb14dd16df; _fbp=fb.1.1669971809475.1168039176; _ga=GA1.1.1601885816.1669971810; _pk_id.11.9c06=eaf1d036c25c6bfd.1669971810.; _pin_unauth=dWlkPU16VTVOR1ZtTmpJdFpHTmtNQzAwTURObExXSXhPVEl0WkdZMk1XSTFZbVZqWVdJMw; _pk_ses.11.9c06=1; _derived_epik=empty; _ga_5EEYGXVFRX=GS1.1.1670011856.5.1.1670016505.0.0.0; _ga_FW712V8LBG=GS1.1.1670011856.5.1.1670016505.0.0.0", client: my.external.ip.address, server: mydomain.com, request: "GET /wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp HTTP/2.0", host: "mydomain.com"
2022/12/02 21:41:13 [notice] 231997#231997: *340 "/checkout/|/zamowienie/|/my-account/|/moje-konto/|/cart/|/koszyk/|/newsletter/" does not match "/wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp", client: my.external.ip.address, server: mydomain.com, request: "GET /wp-content/uploads/2021/03/xop_079-32x32.jpg.pagespeed.ic.tmbiBT965m.webp HTTP/2.0", host: "mydomain.com"
2022/12/02 21:41:13 [warn] 231997#232039: [ngx_pagespeed 1.15.0.0-8917] xop_079-32x32.jpg:0:Resource based on http://mydomain.com/wp-content/uploads/2021/03/op_079-32x32.jpg but cannot access the original

bigretromike avatar Dec 02 '22 21:12 bigretromike

Currently I have the biggest luck while adding pagespeed LoadFromFileMatch "^https?://mydomain.com/([^/]*)" "/var/www/web/\\1"; While pagespeed fetch content thru http FileMatch handles that ? And I can access shrinked images like images1-300x300.webp.pagespeed.ic.0AWUmE4KLo.webp`

I still have no clue why pagespeed inssist to use http I double checked if something is wrong or not with port 80, but it looks like its all disabled: curl -sS -D- -o /dev/null "http://mydomain.com/wp-content/uploads/2021/08/ximage-1-150x146.webp.pagespeed.ic.DWGeCUiHFr.webp" curl: (7) Failed to connect to mydomain.com port 80: Connection refused

bigretromike avatar Dec 03 '22 00:12 bigretromike

In the last config you posted:

pagespeed RewriteLevel CoreFilters; pagespeed RewriteLevel OptimizeForBandwidth;

Both at the same time, don¡t know what is the result.

In the config directives you have

pagespeed CacheFragment web-cache-fragment;

But in the error logs there is

HTTPCache key=http://mydomain.com/wp-content/uploads/2022/06/aot_manga.png fragment=EDITED-cache-fragment: remembering recent failure for 119 seconds. W

Seems to be from another server config.

Lofesa avatar Dec 03 '22 08:12 Lofesa

In the last config you posted:

pagespeed RewriteLevel CoreFilters; pagespeed RewriteLevel OptimizeForBandwidth;

Both at the same time, don¡t know what is the result.

In the config directives you have

pagespeed CacheFragment web-cache-fragment;

But in the error logs there is

HTTPCache key=http://mydomain.com/wp-content/uploads/2022/06/aot_manga.png fragment=web-cache-fragment: remembering recent failure for 119 seconds. W

Seems to be from another server config.

Nah they are the same, I just redacted that name out for my reasones sorry.

pagespeed RewriteLevel CoreFilters;
pagespeed RewriteLevel OptimizeForBandwidth;

Yes I can change that, let me read about it

bigretromike avatar Dec 03 '22 18:12 bigretromike