For the forwarding of queries from a php application on Linux to Windows internal company services using php curl, and delegation. In principle, in 90% of cases works fine. But sometimes there are troubles, instead of the authentication curl_exec returns 401! Looking at the network activity using fiddler to observe that with the running-as-necessary query there are two query
1. Linux->Windows->return 401
2. Linux (Authorization: Negotiate NNNN)->Windows->return 200
And in the not-working-as-necessary the curl refuses to complete step 2 and returns client a 401, without attempting to complete step 2.
Not have you encountered this problem?
Trying to catch 401 in php and preauthenticate again does not lead to the desired result. Still 401 (tried up to 10 retries), for example:
Curl in PHP is not working correctly. I had stupidly call as curl command in shell. It worked.