• In my WordPress plugin, i’m calling an external Api. i deployed this plugin in multiple hostings but it works only on one of them. In others i get this error : wordpress cURL error 7: Failed to connect to X.X.X.X port X after 1002 ms: Connection refused

    Why does this happen ? Is there something to configure or is this just because the hosting has some sort of security setting that block the request ?

    ps 1 : the api is on a personnal server and i have no ssl certificate.
    ps 2 : the wordpress instances are not hosted on the same company hosting service.
    ps 3 : I have Only two plugins installed : woocommerce and my plugin (it’s a plugin for woocommerce)

    Thank you

    • This topic was modified 4 years, 5 months ago by t-p. Reason: Moved to Fixing WordPress from Developing with WordPress
Viewing 2 replies - 1 through 2 (of 2 total)
  • Why does this happen ? Is there something to configure or is this just because the hosting has some sort of security setting that block the request ?

    It’s very likely the latter case.

    Is the port “X” standard HTTP port (80/443)? If not, then the custom port is likely to have been blocked on the server you’re connecting from.

    Just run the curl command directly from the command line (where the WordPress website is hosted) to the API URL and let’s see what is returned.

    eg: curl https://example.com:443

    Another possibility is that the API server may have some ACL, restricting access, and blocking the request from the WordPress server. Kindly check the API server’s firewall logs to see if the blocked curl request is logged there.

    Thread Starter bapn

    (@bapn)

    I’m the owner of the API, it is only available on http on port 8088. it work fine with other projects.
    When i run the curl command it also work fine. it’s only failing when i’m calling it from wordpress.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Rest calls failure’ is closed to new replies.