Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Fetch failed to start on Google Font requests #946

Open
etcook opened this issue Apr 1, 2015 · 24 comments
Open

Fetch failed to start on Google Font requests #946

etcook opened this issue Apr 1, 2015 · 24 comments

Comments

@etcook
Copy link

etcook commented Apr 1, 2015

I'm getting the following error regularly in my logs:

2015/04/01 14:35:07 [warn] 9#0: [ngx_pagespeed 1.9.32.3-4448] Fetch failed to start: https://fonts.googleapis.com/css?family=Merriweather:400,700,900,300

That's the only url that it seems to have an issue with. Are there any recommendations for troubleshooting?

@oschaaf
Copy link
Member

oschaaf commented Apr 1, 2015

@etcook Do you have native fetching on?

@etcook
Copy link
Author

etcook commented Apr 1, 2015

@oschaaf my pagespeed configuration is the following:

    pagespeed on;
    pagespeed FileCachePath /var/ngx_pagespeed_cache;
    pagespeed RewriteLevel CoreFilters;
    pagespeed EnableFilters make_google_analytics_async;
    pagespeed EnableFilters canonicalize_javascript_libraries;
    pagespeed EnableFilters collapse_whitespace;
    pagespeed EnableFilters combine_heads;
    pagespeed EnableFilters dedup_inlined_images;
    pagespeed EnableFilters defer_javascript;
    pagespeed EnableFilters elide_attributes;
    pagespeed EnableFilters inline_import_to_link;
    pagespeed EnableFilters inline_google_font_css;
    pagespeed EnableFilters inline_preview_images;
    pagespeed EnableFilters lazyload_images;
    pagespeed EnableFilters local_storage_cache;
    pagespeed EnableFilters remove_quotes;
    pagespeed EnableFilters in_place_optimize_for_browser;
    # pagespeed EnableFilters sprite_images;
    pagespeed EnableFilters insert_image_dimensions;
    pagespeed EnableFilters move_css_above_scripts;
    pagespeed EnableFilters move_css_to_head;
    # pagespeed EnableFilters insert_dns_prefetch;
    pagespeed EnableFilters prioritize_critical_css;
    pagespeed EnableFilters remove_comments;

I do not have pagespeed UseNativeFetcher on; set

@oschaaf
Copy link
Member

oschaaf commented Apr 1, 2015

@etcook Thanks.
I missed the fact that you are getting this error for a https url. You might want to enable https support, which should help with getting rid of the warning:
https://developers.google.com/speed/pagespeed/module/https_support

@etcook
Copy link
Author

etcook commented Apr 1, 2015

@oschaaf Let me get that configured right now, thanks. Our entire site is https - would that really be the only asset it's trying to fetch over https?

@etcook
Copy link
Author

etcook commented Apr 1, 2015

@oschaaf I added domain mapping for fonts.googleapis.com - thank you so much.

@etcook etcook closed this as completed Apr 1, 2015
@etcook
Copy link
Author

etcook commented Apr 1, 2015

@oschaaf I thought I had it, but no luck.

Was this not the right way to handle it? I put this in the server block:

    pagespeed MapOriginDomain "http://fonts.googleapis.com/" "https://fonts.googleapis.com/";

@etcook etcook reopened this Apr 1, 2015
@jeffkaufman
Copy link
Contributor

Can you turn on HTTPS Fetching? https://developers.google.com/speed/pagespeed/module/https_support#https_fetch

pagespeed FetchHttps enable;

@etcook
Copy link
Author

etcook commented Apr 1, 2015

@jeffkaufman It is now resolved. Is fetchhttps required for maporigin to work?

@jeffkaufman
Copy link
Contributor

MapOriginDomain probably didn't work here because Google Fonts is HTTPS only.

Which means https://developers.google.com/speed/pagespeed/module/filter-css-inline-google-fonts should be telling people to turn on FetchHttps. I'll do that.

@etcook
Copy link
Author

etcook commented Apr 1, 2015

@jeffkaufman
Copy link
Contributor

Hmm, I'm not sure why. @morlovich can you look at this? Why do we need FetchHttps and not MapOriginDomain here?

@etcook
Copy link
Author

etcook commented Apr 2, 2015

Note, the inline injected CSS from the inline_google_font_css filter seems to output the http proto variant, regardless of whether you have https enabled or not.

@jeffkaufman
Copy link
Contributor

seems to output the http proto variant, regardless of whether you have https enabled or not.

Does this give you a mixed content warning then?

@etcook
Copy link
Author

etcook commented Apr 2, 2015

@jeffkaufman Unfortunately, yes.

@jeffkaufman
Copy link
Contributor

@etcook Is the mixed content problem with FetchHttps or just MapOriginDomain?

@etcook
Copy link
Author

etcook commented Apr 2, 2015

@jeffkaufman I'm no longer using MapOriginDomain.

@jeffkaufman
Copy link
Contributor

@etcook ok, just checking.

I'll need to set up a test site.

@islamx
Copy link

islamx commented May 28, 2015

Hi,

Sorry for the basic question,
Please where i should be put the pages-peed configuration?

Should this change made by hosting provider through administration?

@jeffkaufman
Copy link
Contributor

@islamx With questions the best thing to do is to write to https://groups.google.com/forum/#!forum/ngx-pagespeed-discuss This thread here is for discussing a bug, and it seems like you're having an unrelated problem.

@clandestino52
Copy link

Hello,

I think this issue is still not resolved.

When I enable https fetching,
ModPagespeedFetchHttps enable,allow_self_signed,allow_unknown_certificate_authority,allow_certificate_not_yet_valid

I have this error

Fetch failed to start: https://fonts.googleapis.com/css?family=Montserrat&display=swap
[https://fonts.googleapis.com/css?family=Montserrat&display=swap:0] serf_context_run error status=20014 (Internal error (specific information not available))

If I disable https fetching the font inlining works.

Version: 1.13.35.2-0

@Lofesa
Copy link

Lofesa commented Nov 26, 2020

@clandestino52
Have you set the certificates? if you enable ModPagespeedFetchHttps you need to set ModPagespeedSslCertDirectory and ModPagespeedSslCertFile
https://www.modpagespeed.com/doc/https_support#configuring_ssl_certificates

Think in pagespeed fetching a url as a brownser doing the same, for ssl the brownser need CA certificates.

@clandestino52
Copy link

Yes of course I did. But not sure if it's correct. Https fetching seem correct for domain pages except for google fonts.

ModPagespeedSslCertDirectory "/etc/pki/tls/private"
ModPagespeedSslCertFile private-certificate.key

/etc/pki/tls/private is the directory where private-certificate.key file exist.

private-certificate.key is our domain private key.

@Lofesa
Copy link

Lofesa commented Nov 26, 2020

I think is not correct.
You have pki in your path, so maybe is a redhat/centos distro, so the directives must be:

ModPagespeedSslCertDirectory /etc/pki/tls/certs
ModPagespeedSslCertFile /etc/pki/tls/cert.pem

and the cert.pem is a link to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

As you can see this file is a CA bundle, not the certificates for your server.

@clandestino52
Copy link

Thank you Lofesa. It works !

I thought that the certificate must be my SSL domain certificate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants