Archived topic
Site Library won't load with new GP Premium on multisite server
5 replies · Started by Matt on May 6, 2021
JS Errors
/wp-json/generatepress-site-library/v1/get_sites?_locale=user:1 Failed to load resource: the server responded with a status of 404 ()
themes.php?page=generatepress-library:1 Uncaught (in promise) Objectcode: "rest_no_route"data: {status: 404}message: "No route was found matching the URL and request method."__proto__: Object
Hi there,
Can you try a few things?
-If the GP Premium plugin isn't updated, can you try updating to the latest version? (v 2.0.2)
-Can you try clearing ALL cache? (site plugin & server-side caching)
-Disable ALL plugins except GP Premium. (to check if it's a plugin conflict)
Let us know how it goes.
Hi Elvin.
It seems it's not wordpress related directly, but the apache & nginx cache settings I have in place server to help with page speed scores. I have had to remove all of these to get premium versions of generateblocks & generatepress to function correctly with saving settings/updating/displaying site library.
So now I am stuck with deciding on speed to please google or functionality to please users!!
These are the settings I have had to remove (as recommended by Kinsta - one of your recommended hosts https://generatepress.com/wordpress-hosting/):
--- APACHE ---
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header set Cache-Control "max-age=86400, public"
</filesMatch>
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##
--- NGINX ---
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
location ~* \.(jpg|jpeg|gif|png|svg)$ {
expires 365d;
}
location ~* \.(pdf|css|html|js|swf)$ {
expires 2d;
}
I'm not seeing anything there that would affect the WordPress REST API, which the new Site Library uses. Did they offer any additional insight into what about that code would prevent the REST API from working? We're on Kinsta as well and haven't noticed any issues.
Hi Tom
I managed to resolve the issue although not sure why it fixes it. I am not on kinsta, but use a dedicated apache/nginx server so similar setup in terms of webserver technology. My server has plesk and the following setting seems to break the api call (but only on your plugins?)
'Serve static files directly by nginx'
It has to be switched off. Even excluding .js files from the list of static files doesn't fix it. it MUST be switched off. It just means that Apache is now doing more than it was, but with caching in place it hasn't effected page speed/lighthouse scores as far as tell.
Many thanks.
Matt.
Hi Matt,
Thanks for reporting back!
We're simply using the WordPress REST API - nothing custom. So, if it breaks our API calls, it's likely it will also break other plugins that make use of the REST API.
Not exactly sure why that option would do it - couldn't find anything in my searches.
Of course, you can turn it back on once you're done loading and importing a site - the Site Library is a one-use kind of thing, you can turn it off completely once you're done.
Thanks again!