0

I have Drupal running in a docker container and nginx running in another container.

When I do the login call through postman or directly on the webserver cli it works perfectly. But when I do call from within my application I get a timeout after 30 seconds.

From server:

wodby@php.container:/var/www/html $ curl -X POST \ 'http://api.swappr.localhost/user/login?_format=json' \ -H 'Postman-Token: a9c80844-ed69-4d24-b205-6475b7e469dc' \ -H 'cache-control: no-cache' \ -d '{"name":"logintest2@gmail.com", "pass":"password"}' {"current_user":{"uid":"21","name":"logintest2@gmail.com"},"csrf_token":"yf5YBYyY4YvXCcufLyTWeKnvbhq5sdcZHpgmsVDeSRY","logout_token":"PEarVS7vPi5idARarGQzrrXAYcJL9YkiXmoHw_a7yJE"}

In code:

$response = \Drupal::httpClient()->post(
            'http://api.swappr.localhost/user/login?_format=hal_json',
            ['name' => 'logintest2@gmail.com', 'pass' => 'password']
        );

cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Anyone knows what could cause this problem?

1
  • 1
    Sounds like a networking problem?
    – Kevin
    Jan 17, 2019 at 15:38

1 Answer 1

0

Okay turns out it was xdebug. I had to allow more simultaneous connections in the PHP Debug settings of PHP Storm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.