Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

353
Views
cURL proxy hangs for 30 seconds on the initial request

Firstly I will try to explain how the setup I am trying to debug works.

  • First off, an XHR/Ajax request is made from the client (JavaScript).
  • This request gets sent off to a Windows/Apache/PHP server
  • This server acts as a proxy, which accepts the request, processes the data and proxies it onto another server, with cURL
  • The cURL request is sent to a Windows IIS server, which accepts the data, and returns some values back to the PHP proxy server
  • The PHP proxy server does some work with the values and then returns them back to the client (JavaScript)

Some other information:

  • The purpose of this PHP cURL proxy is that it is a single sign-on authentication API.
  • The process is much inspired by this answer: How youtube gets logged in to gmail account without redirect?.
  • The PHP cURL proxy acts as the single sign-on API which stores authentication tokens.
  • The Windows IIS server is the place that username/passwords are sent to, and potentially returns an auth token.

The problem:

On the initial request, there is a 30 second wait time until a response is returned, it's almost like the servers are asleep and need waking up. After the initial request successfully gets a response, subsequent requests are returned in less than 1 second. If no requests are made for a space of time (say 30 minutes), the slow initial request happens again.

A direct request to the PHP Auth API never has this long wait, the same goes for the Windows IIS endpoint - but when there's a cURL between the two, the long wait occurs.

Can anyone point me in the right direction here? Maybe it's something obvious that I haven't considered? Would "Keep connection alive" type parameters be of help?

I hope I have explained the problem properly and if more information is needed, just ask.

Thank you Stack Overflow!

enter image description here

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Have you considered that as this is the 'first' time you have called the API, that the API itself may have just gone to sleep, and its own initialisation has startup steps which take a little time to run.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!