• Resolved puregraphx

    (@puregraphx)


    Hi,
    I have been using your plugin for a few years now with success (except some occasional glitches), but today I created my first OpenLiteSpeed server via Runcloud and Digital Ocean.
    I did not get this error on the staging (Cloudways Apache/Nginx stack on DO), but after the move to OLS, I get:
    “OMGF encountered an error while downloading Google Fonts: rest_no_route – No route was found matching the URL and request method.”

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    When are you getting this error?

    Thread Starter puregraphx

    (@puregraphx)

    Sorry for the late reply, didn’t get an update email from this ticket.
    I get this error upon clicking Save & Optimize.
    Have not yet encountered this error on other WP sites though.

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi again,

    Are you using any security related plugins that might be blocking creating/accessing WP API endpoints?

    I’d suggest disabling plugins one by one, to see if any of them is interfering. Once you found it, please let me know so I can contact the developer and see if we can workout some sort of compatibility.

    Happy holidays! ??

    I’m having the same problem. Can’t see anything blocking API calls.

    URL: https://dev.get-business-online.com/ronitbaras/?nocache

    What is the plugin trying to do? Maybe I can try it manually?

    Following some generic online advice, I re-saved my permalinks, and then visited https://dev.get-business-online.com/ronitbaras/wp-json/. The relevant entries were

    "\/omgf\/v1":{"namespace":"omgf\/v1","methods":["GET"],"endpoints":[{"methods":["GET"],"args":{"namespace":{"default":"omgf\/v1","required":false},"context":{"default":"view","required":false}}}],"_links":{"self":[{"href":"https:\/\/dev.get-business-online.com\/ronitbaras\/wp-json\/omgf\/v1"}]}},"\/omgf\/v1\/download\/css":{"namespace":"omgf\/v1","methods":["GET"],"endpoints":[{"methods":["GET"],"args":[]}],"_links":{"self":[{"href":"https:\/\/dev.get-business-online.com\/ronitbaras\/wp-json\/omgf\/v1\/download\/css"}]}},"\/omgf\/v1\/download\/css2":{"namespace":"omgf\/v1","methods":["GET"],"endpoints":[{"methods":["GET"],"args":[]}],"_links":{"self":[{"href":"https:\/\/dev.get-business-online.com\/ronitbaras\/wp-json\/omgf\/v1\/download\/css2"}]}}

    Thread Starter puregraphx

    (@puregraphx)

    I ditched the RC/OLS server, so this problem fixed itself for me ??

    I’m on LiteSpeed (commercial). Could that be the problem?

    @daanvandenbergh can you please look into this? LiteSpeed accounts for 12.2% of the web servers (and almost all of mine).

    I’m having this problem on more than one (test) site. In fact, simply saving the plugin’s settings REMOVES any configured fonts.

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi guys,

    I know a guy who runs a (O)LS specific hosting company. I’ve sent him a message to ask him if he ever ran into this issue.

    He uses my plugins in his speed optimizations.

    I’ll get back to you when I know more.

    Thanks!

    Is there no debugging option to get more information?

    What exactly is the plugin doing? Maybe I can use that to test.

    Can you add a fallback method for when the API call fails?

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Nope. There’s no debugging information. Still on my todo list.

    At the moment you click Save & Optimize, when in Manual optimization mode:

    1. It grabs the mentioned URL’s source code,
    2. Parses the enqueued stylesheets for possible Google Fonts stylesheets,
    3. Downloads these Google Fonts through the OMGF API (wp-json/omgf/v1/download/css(2))
    4. Generates a stylesheet.

    But, since you’re getting a rest_no_route error, it means it’s stalling at point 3. It can’t find the API endpoint.

    This is a WordPress error, which should only be thrown when the API endpoint doesn’t exist or isn’t properly registered.

    Also, when testing your API endpoint using the following URL: https://dev.get-business-online.com/ronitbaras/?rest_route=/omgf/v1/download/css

    I get an error that ‘Sorry, you’re not allowed to do that.’ Which is a good thing, because that’s an error OMGF throws when the current user isn’t logged in or doesn’t have administrator rights.

    So, the API exists!

    I search for ‘rest_no_route Litespeed’ and found this article in the QUIC.cloud documentation, which might be helpful, especially the Plugin Problems section: https://quic.cloud/docs/troubleshooting/verify-wordpress-rest-api-is-active/

    Let me know how it goes!

    I’ve followed the QUIC.cloud guide and couldn’t detect the problem.

    I’ve tested the API endpoint using your link while being logged in as an administrator and got the same “sorry/401” message. What now?

    Can this be related to the site being in a subdirectory?

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    I don’t think so. We confirmed that the API exists, while testing within the subdirectory.

    Just to confirm, have you disabled all other plugins (maybe even switched to a default theme) to make sure it’s not a plugin issue?

    I can confirm that switching to TwentyTwenty doesn’t help, and that deactivating every plugin other than OMGF doesn’t either.

    What next? I’m not familiar with REST API. What’s the sequence involved and where could it be failing?

    • This reply was modified 2 years, 9 months ago by Gal Baras.

    OK, so I decided to to debug the code myself.

    First up, I printed out the request URL:

    https://dev.get-business-online.com/ronitbaras/wp-json/omgf/v1/download/css?family=Open+Sans%3A300%2C400%7CQuestrial%3A400&handle=google-fonts&original_handle=google-fonts&_wpnonce=65151758aa

    Visiting this URL give this:

    {"code":"rest_cookie_invalid_nonce","message":"Cookie check failed","data":{"status":403}}

    Moreover, I’ve made several tests and the nonce is always the same. Could this be the issue?

    While we’re on this, I don’t see the point of using the REST API for this. Can you not download the fonts directly from Google Fonts using cURL of `file_get_contents()?

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘OMGF encountered an error while downloading Google Fonts: rest_no_route – No rou’ is closed to new replies.