[Resolved] cURL error 28: Connection timed out after 10000 milliseconds

Home Forums Support [Resolved] cURL error 28: Connection timed out after 10000 milliseconds

Home Forums Support cURL error 28: Connection timed out after 10000 milliseconds

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #1334921
    JERRY

    InMotion Hosting tells me the solution as follows:

    [Jacob M.] I see. So in regards to the curl error, that is likely because the plugin is not using a user agent to connect to the server.

    A user agent is required to make these connections to the server. Unfortunately, this is not something that we can adjust for you.

    As the plugin developer will need to correct their code to be able to implement this. Unfortunately, that is the only way of correcting this issue, as there is no other workaround, as you are on a shared server, and it is not possible to remove that limitation.

    This may be the case for many GeneratePress clients that have exhausted all possible remedies, and no solution has helped.

    Generate Press can this be a possibility to help us out?

    #1335556
    Tom
    Lead Developer
    Lead Developer

    Thanks for that – I’ll do some digging.

    While this error does come up sometimes, hundreds of license keys are being activated/deactivated every day with no issues, so it’s likely something they could adjust on their end (since many other hosts don’t have an issue with it). However, this really helps – I’ll see if it’s something we can do ๐Ÿ™‚

    * Edit *

    Just looked into the code. We use wp_remote_post() to make the request: https://developer.wordpress.org/reference/functions/wp_remote_post/

    While we don’t specify a user-agent, the function uses these default args: https://developer.wordpress.org/reference/classes/WP_Http/request/

    They can see that there is a default user-agent which is sent with the request: WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' )

    #1335643
    Tom
    Lead Developer
    Lead Developer

    Another update here. We can test their idea by adding a different user-agent:

    add_filter( 'http_headers_useragent', function( $user_agent, $url ) {
        if ( 'https://generatepress.com' === $url ) {
            $user_agent = $_SERVER['HTTP_USER_AGENT']; // Or whatever they require.
        }
    
        return $user_agent;
    }, 10, 2 );
    #1335928
    JERRY

    Ok, so what do I have to do to try to implement this?

    Also, did you want me to ask them what user agent it needs to be? I am not a coder, so I am not sure what you require from them to code successfully.

    #1336518
    Tom
    Lead Developer
    Lead Developer

    You can try adding the code I provided above to your website: https://generatepress.com/forums/topic/curl-error-28-connection-timed-out-after-10000-milliseconds-2/page/2/#post-1335643

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    If it doesn’t work, you can ask them what the user-agent should be, as the code already sends a user-agent by default, and the above will send the user-agent associated with your browser.

    #1336930
    JERRY

    Ok, it did not work. I posted the code snippet via the Code Snippets plugin. I am now going to reach back out to InMotion Hosting to find out what user-agent I need to have.

    #1342203
    JERRY

    (This is a reply from my hosting provider)

    This message regards some trouble updating the GeneratePress plugin.

    I do apologize for this issue! I’ve fully checked.

    First, I fully updated the site to use PHP 7.3, and maxed the PHP settings. This is in case the problem is caused by something else.

    Then, I got logged in and tested the plugin. The error displayed:

    “cURL error 28: Connection timed out after 10000 milliseconds”

    Now that the user agent is fixed, this issue can only be due to latency in the request being answered by the GeneratePress servers.

    I do see they are aware of the slowness because they provide an alternative method for updating the plugin, mentioned here:
    https://docs.generatepress.com/article/updating-gp-premium/

    When a curl request is made, it’s the same as requesting a webpage. The request must be answered by the resource being called within an amount of time.

    The curl timeout setting can be modified on Reseller VPS.

    In addition the actions mentioned above, I also employed standard WordPress troubleshooting. I deactivated all plugins, and was still able to recreate the problem. I also optimized the WordPress database.

    Sorry again for this issue. More recent plugins use the WordPress Requests library, and not curl directly. Here’s an article about it:

    https://deliciousbrains.com/php-curl-how-wordpress-makes-http-requests/

    #1342875
    Tom
    Lead Developer
    Lead Developer

    Hmm, well I don’t believe it’s the load time of the request, as we successfully process hundreds of license keys every day.

    Some hosts just seem to have an issue with it, and their support teams aren’t able to find the issue. We’ll look into cURL alternatives, but I do believe it’s the standard when it comes to WordPress.

    #1350056
    JERRY

    Ok, thank you, will you be looking for Curl alternatives? I bet this will help those clients in the middle like me. Thank you for all of your help.

    #1350837
    Tom
    Lead Developer
    Lead Developer

    I’ll definitely look into it, although I fear that if servers are preventing cURL from working, it will likely be the same with other methods.

    #1368765
    JERRY

    Ok, thank you. Please let me know if you have found another method, then I can dismiss their theory, and put the ball back into their court, if it does not work.

    #1397984
    JERRY

    Hey Tom,

    what did you do? I logged into one of my Word Press sites and it say that Generate Press needed an update, and I was apprehensive. But, I tried to update, and IT WORKED!

    What did you do to fix this, I am on cloud nine. Now people in the forum with this issue is probably fixed, now, Awesome!

    Question not related, but are you all going all in on Gutenberg Blocks? that is truly the WordPress of the future, and I think it makes making Word Press sites easier.

    Thanks, Tom and Generate Team!

    #1399188
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    We haven’t done anything on this front, but glad to hear it’s working now! I assume something changed with your hosting/server to allow the communication.

    Yes, we’re very excited and serious about our GenerateBlocks plugin: https://generateblocks.com

    Lots of cool things on the way! ๐Ÿ™‚

Viewing 13 posts - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.