Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

360
Vistas
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

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

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.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda