Nginx and curl request (more than one at same moment)
I write WP plugin locally - wordpress.oo.
I have second app app.oo with REST API server.
In wordpress plugin i make api call to my app.
Everything is fine until i try make more than one request at the same moment:
wp_remote_request('/api/auth/login', ['method' => 'POST]);
wp_remote_request(/api/method', ['method' => 'GET'']);
Login works (return json) but second return:
cURL error 28: Operation timed out after 5000 milliseconds with 0 bytes received.
Nginx access log:
127.0.0.1 - - [14/Feb/2019:00:21:37 +0100] "POST /api/auth/login HTTP/1.1" 200 380 "http://app.oo/api/auth/login" "WordPress/5.0.3; http://app.oo"
127.0.0.1 - - [14/Feb/2019:00:21:42 +0100] "GET /api/diary/teams HTTP/1.1" 499 0 "http://app.oo/api/method" "WordPress/5.0.3; http://app.oo"
I tried use api from my production server (also nginx) and works fine.
@Marek-Gralikowski : Please look into
Of course I tried to find solution before posting and i found this thread on Stack. I tried solution with proxy_ignore_client_abort
In my opinion is close to the problem but solution doesn't fit to curl requests (I tried add sleep between requests).
@Marek-Gralikowski any updates on how you solve this? I am also encountering the same issue especially when using guzzle http client, one request will be fine but the next request will be hanged up and the browser just keeps on loading.
Sorry, no solution found by me.
Generally i build api client with some kind of cache so i need refresh page (api calls) couple times and works.
I got the solution...
Set PHP config:
max_execution_time set to 0
max_input_time set to -1
memory_limit set to 4G
Then open your
so that it will look like this
[nginx] Version=nginx-1.14.0 Use=-1 DocumentRoot=D:\yourfolder Port=80 Upstream=5
I will try, thanks.
@Marek-Gralikowski The reason for this because laragon is only default to one single php process, that's why when multiple request happens it seems it cancels out other request causing 499.. Adding more process like 5 processes of course handle multiple process which solves the issue.. I found that note in file