Site logo

Archived topic

Bad Request 400 to Google Apis

4 replies · Started by John on May 16, 2018

Viewing posts 1–5 of 5

I'm trying to do a little test of two hosts and somehow on one host I get a bad 400 request for css rather than a 200.

https://site321425.nestifysites.com/
<link rel="stylesheet" id="generate-fonts-css" href="//fonts.googleapis.com/css" type="text/css" media="all">

on the other one I get this which works.
http://159.65.36.233/
<link rel="stylesheet" id="generate-fonts-css" href="//fonts.googleapis.com/css?family=Lato:300,regular" type="text/css" media="all">

I checked the settings under fonts and they are the same. I'm really scratching my head. I cloned the site over so it should be 99.9% the same. Is there anything you can think of to check? I'm sure this will be a learning lesson. Thanks!

Hi there,

That's strange - it's like the value of your Google Font setting isn't coming through. Perhaps it was lost when you cloned the site.

Can you try re-setting it in the Customizer and then save the options?

I have. I tried setting it to inherit and then back to Lato. =\ I tried turning off caching as well. Do you want an admin login?

I figured it out. I guess I forgot I had activated a snippet to remove query string from static resources. I suppose that breaks the googleapi call? I'll have to double check the forum.

function _remove_script_version( $src ){ 
$parts = explode( '?', $src ); 	
return $parts[0]; 
} 
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); 
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

Ah yes, that'll do it.

Removing query strings will give you better scores with page speed tools, but that's it. Doing it will cause a lot of issues, and it won't make your site faster.

Basically that code removes everything after the ? character in a resources, which includes the names of the Google fonts.

This archived topic is closed to new replies.