Empty response on discourse login API call

(Hosein Naseri) #1

I have about 6k login api calls per day. However about 5% of them do not have any response from discourse. The interesting thing is that there is no sign of these 5% failed api calls in the production.log file too.

Our login api is this:

public static function Login($user_name, $user_pwd){
        $data = array(  'login'=>$user_name,

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, self::$discourse_url."session");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
        $ip = $_SERVER['REMOTE_ADDR'];
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-FORWARDED-FOR: $ip"));
        $response = curl_exec($ch);
        return $response;

What could be wrong? and where should I look for more information about this matter?

(Matt Palmer) #2

If they’re not making it to production.log, then they’re not getting to Discourse. Trace the request’s progress through whatever chain of proxies you have upstream to determine where they’re getting lost. There you will find the answers you seek.