• Resolved burnuser

    (@burnuser)


    I Know this issue has already been reported, but OMGF does not work on local environments with several error messages (on different local http and self signed https environments):
    1.) OMGF encountered an error while fetching this site’s frontend HTML: http_request_failed – cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received
    2.) OMGF encountered an error while downloading Google Fonts: http_request_failed – cURL error 60: SSL certificate problem: self signed certificate
    3.) OMGF encountered an error while downloading Google Fonts: http_request_failed – cURL error 7: Failed to connect to wpt.test port 443: Connection refused

    It works with online https environments (with a real SSL certificate) without any problem.

    Some times ago your answer on this issue was, that WordPress Version x.y requires SSL for this task, but you will disable this in a future OMGF version to make it work on http environments again.

    My unresolved problem is: I’m teaching WordPress on local environments (like Laragon or Local by Flywheel) and can not show OMGF to my trainees since http support in OMGF is broken ??

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

    (@daanvandenbergh)

    Hi!

    I know I promised before to disable SSL verification, but after researching it a little I decided against it, because simply put: it’s a security issue, and to create a whole option for it to toggle it seems excessive. Especially since people will only run into this on local (non-SSL) environments).

    So, you can do 1 of the following:

    1. Create a self-signed SSL certificate, or
    2. Create a plugin which disables SSL verification like so:

    function disable_sslverify($params, $url)
    {
        $params['sslverify'] = false;
    
        return $params;
    }
    add_filter('http_request_args', 'disable_sslverify', 10, 2);

    Hope it helps!

    Thread Starter burnuser

    (@burnuser)

    ad 1.) self signed certificate does not work as stated above:
    “OMGF encountered an error while downloading Google Fonts: http_request_failed – cURL error 60: SSL certificate problem: self signed certificate”

    ad 2.) added your code with Plugin “Code Snippets”
    a) does not work on “Laragon” with http => same error as before
    “OMGF encountered an error while downloading Google Fonts: http_request_failed – cURL error 7: Failed to connect to wpt.test port 443: Connection refused”
    b) does not work on “Local” with http => error message, but after refreshing the page found google fonts are shown, but … not downloaded
    c) works in a crazy way on “Local” with self signed SSL certificate => error message, but after refreshing the page found google fonts are shown … and installed

    That is interesting but nothing that I can use in a classroom for teaching WordPress in local environments. So I have to exclude OMGF from my lectures.

    Anyway, thank You for your efforts.

    Thread Starter burnuser

    (@burnuser)

    Found a solution which works on http without any tricks:
    https://www.ads-software.com/plugins/wrap-google-fonts/

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi again,

    I assume you don’t know how to create a plugin, since you used Code Snippets to add the code I provided for you. So I did it for you.

    Copy the file in this Github repository to your wp-content/plugins/ folder and OMGF will work without any crazy stuff: https://github.com/Dan0sz/disable-sslverify

    I develop OMGF on a local environment after all, so I know this’ll work ??

    Thread Starter burnuser

    (@burnuser)

    Tried your plugin:
    a) with “save target as” from github => does not work (100kB file with a lot of github xyz crap)
    b) copy code from github in texteditor ans saved as .php => 1kB file
    => works with the exact same results on “Laragon” and “Local” (two common local environments) as my test with “Code Snippets” (which usually works very well for such tests)

    But you are right, I’m not a programmer and so I ask you, if you could take a look at the code of https://www.ads-software.com/plugins/wrap-google-fonts/ which works out of the box even on local http sites.
    Maybe there is a solution in this other plugin for downloading Google fonts which could be integrated in OMGF?

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Ok, yeah. Save target as…’ isn’t gonna work.

    The 2nd method should work. Shame that it doesn’t work as expected.

    I will take a look at that plugin’s code! Might learn a thing or two ??

    Good luck with your lectures!

    Plugin Author DaanvandenBergh

    (@daanvandenbergh)

    Hi again,

    I looked into the plugin and there’s a few significant differences between OMGF and Google Fonts Wrapper.

    1. OMGF uses Google Fonts Helper to fetch the fonts in different filetypes, and generates a stylesheet which is cross-browser compatible, whereas the wrapper simply copies the stylesheet from Google Fonts’ server upon the first request, along with the accompanied fonts. This means that only the version compatible with the browser making the first request is fetched, e.g. .woff2 on Chrome or Firefox, but .ttf on some mobile devices.
    2. Google Fonts Wrapper uses native PHP functions to do the fetches (curl_exec()), whereas OMGF uses WordPress’ wp_remote_get() function, which essentially is a more secure wrapper for PHP’s native curl feature set.

    At this point, I’m researching if I could modify its behavior based on what protocol you’re using. But nothing I can release short term I’m afraid.

    Thanks for the heads up, though. Definitely should do something about this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Does not work on local environment’ is closed to new replies.