I’m trying to build a WordPress plugin to make a GET request to the server that I’m running on Local. This is not a request to a remote server (server external to the one running on Local). It’s an internal server request ( a request to the very server that the site is running on ).
I’m using the WordPress API function wp_remote_get( home_url() );
and then outputting the result to the front end. It returns the following error message:
http_request_failed =>
[ 0 => “cURL error 28: Operation timed out after 5000 milliseconds with 0 bytes received” ]
I’ve set the $args parameter in wp_remote_get()
as high as 300 seconds ( 5 minutes ). No effect. Error returned.
Checked the nginx configuration file.
http {
fastcgi_read_timeout 1800s;
proxy_read_timeout 1800s; // Added this.
}
Eighteen hundred seconds for a timeout (30 minutes) seems plenty long. No effect. Error returned.
A colleague who is running this plugin right now (which runs wp_remote_get()
) on a site hosted by Local has no problems running this WP function and returning the response header and body from her local server. So it suggests there’s something off with my setup.
Here’s what I know about my own system thus far:
- OS: MacOS 10.14.6 (Mojave)
- Local: v5.2.5+2498
- local firewall on my computer: off
- ISP: AT&T, which operates a firewall on their router. Not sure that it matters since I’m not making external server requests via my ISP.
- Xcode v11.3.1. I accepted their terms of service. Not running in the background.
- DNS Settings for my ISP: {
4.4.4.4
8.8.8.8
8.8.4.4
} // I think these were set for the benefit of Google Chrome.
From the router log 2 days ago (formatted for readability):
2020/03/03 20:43:19 [error]
17718#0: *9 upstream prematurely closed connection while reading response header from upstream, client: ::1,
server: ktcstarter.local,
request: "GET / HTTP/1.1",
upstream: "http://127.0.0.1:10000/",
host: "ktcstarter.local",
referrer: "http://ktcstarter.local/"
What do I need to investigate to evaluate and hopefully resolve this problem?