You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an Elastic cluster that uses basic authentication.
Our PHP application uses Elastica to connect to the elastic server.
Today I found a strange problem in the application
It seems when we execute a query on elastic, Elastica first tries to establish a connection without credentials and when it got a credential error, It tries again to use the credentials.
We saw this behavior on the access log web server.
I have attached an image of the log.
As you see at first it got 401 status code, then it sent the second request (with credentials) and it got 400 status code which is Ok (because in my example code I wrote a wrong query).
Plus you can see the example code that generates this log.
This behavior is just like a browser. when you try to connect to elastic with your browser, first it tries to connect without credentials, then it will show the pop up to enter the username and password.
This is a very big problem especially when you have a lot of concurrent connections. For example, 100 queries will establish 200 connections on elastic.
The text was updated successfully, but these errors were encountered:
There isn't a config to set the type of auth. So when you set CURLOPT_HTTPAUTH to CURLAUTH_ANY, curl will send the first request to get the type of auth.
My colleague is going to fix the problem and send a pull request.
Thanks
I added auth_type option to resolve the problem of duplicate requests in [1789 issue](#1789 "1789 issue")
```php
'auth_type' => null //basic, digest, gssnegotiate, ntlm
```
We have an Elastic cluster that uses basic authentication.
Our PHP application uses Elastica to connect to the elastic server.
Today I found a strange problem in the application
It seems when we execute a query on elastic, Elastica first tries to establish a connection without credentials and when it got a credential error, It tries again to use the credentials.
We saw this behavior on the access log web server.
I have attached an image of the log.
As you see at first it got 401 status code, then it sent the second request (with credentials) and it got 400 status code which is Ok (because in my example code I wrote a wrong query).
Plus you can see the example code that generates this log.
This behavior is just like a browser. when you try to connect to elastic with your browser, first it tries to connect without credentials, then it will show the pop up to enter the username and password.
This is a very big problem especially when you have a lot of concurrent connections. For example, 100 queries will establish 200 connections on elastic.
The text was updated successfully, but these errors were encountered: