Facebook SDK v4 behind a proxy

This is a really short note.

If You try to use this SDK behind a proxy e.g. in a Drupal site with simple_fb_connect module You may experience that the SDK wont honor Your proxy_server settings done sitewide. All requests try to go to FB servers directly and timing out. 🙁

I made the change below to workaround this.

--- facebook-php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php.orig        2016-04-04 21:42:21.846561162 +0200
+++ facebook-php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php     2016-04-04 21:55:18.024673677 +0200
@@ -178,6 +178,8 @@
       CURLOPT_SSL_VERIFYHOST => 2,
       CURLOPT_SSL_VERIFYPEER => true,
       CURLOPT_CAINFO         => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
+      CURLOPT_PROXY    => variable_get('proxy_server',''),
+      CURLOPT_PROXYPORT        => variable_get('proxy_port',''),
     );

     if ($method !== 'GET') {

Now the requests going to the proxy.

I didnt found any other solutions on the Internet. This may mean that there is a trivial point somewhere for this setting which I didnt found or nobody used before that SDK behind proxy?

Drupal SSO: An unsupported mechanism was requested…

Here is a step that may help You to debug the error above.

Today I was setting up SSO on a Drupal page against MS AD. Something went wrong and I found the following message in site’s error_log:

gss_accept_sec_context() failed: An unsupported mechanism was requested (, Unknown error)

Let’s modify a little bit apache’s config, and add this to appropriate place (global or vhost level):

 LogLevel debug

Restart apache and check the log again:

kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
Acquiring creds for HTTP/intranet.kesz.hu@KESZ.HU
Verifying client data using KRB5 GSS-API
Client didn't delegate us their credential
Warning: received token seems to be NTLM, which isn't supported by the Kerberos module. Check your IE configuration.
GSS-API major_status:00010000, minor_status:00000000
gss_accept_sec_context() failed: An unsupported mechanism was requested (, Unknown error)

So the real problem was: Warning: received token seems to be NTLM, which isn’t supported by the Kerberos module. That is much more informative than the unknown error we had before!

Dont forget to set back LogLevel after You finished because the log file fast becomes really large…