Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

354
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda