title: Android - Volley library: Session expired issue in SSL production environment
body: <p>I had 2 pages: first one is login page and second is category page. In login API after entering the credentials, I am getting the response as sesssion id from response header.
  The sesssion id will be saved and it will use for further API calls. I am trying to call second API (category page). In this page, as an input am passing the saved session id in the request header. Getting response as "session expired". Also tried to pass <code>Set-Cookie: PHPSESSID=d9f9sdkfjs9</code> in the request header. but it didn't work.</p>
  
  <p><strong>Note :</strong></p>
  
  <ol>
  <li>I am experiencing this issue in production environment only (SSL included)</li>
  <li>I am using volley library for handling APIs.</li>
  </ol>
  
  <p><br></p>
  
  <pre><code>public void fnCallLoginAPI() {
      try {
          //DEMO URL
          //final String URL="http://demo.io/api/api.php?m=login";
          //LIVE URL
          final String URL = "https://www.live.com/shop/api/api.php?m=login";
          final String requestBody = "email=abc.b@xyz.com" + "&amp;password=43443==" + "&amp;strPlatform=i" + "&amp;strDeviceToken=null";
                StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener&lt;String&gt;() {
              @Override
              public void onResponse(String response) {
                  String strResponse = response;
                  System.out.println("THE RESPONSE IS in PROFILE IS" + response);
                    }
          },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
  
                      }
                  })
          {
              @Override
              public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  Map&lt;String, String&gt; headers = new HashMap&lt;&gt;();
                  headers.put("Cookie", "PHPSESSID=" + sessionID);
                  return headers;
              }
   @Override
              public byte[] getBody() throws AuthFailureError {
                  byte[] body = new byte[0];
                  try {
                      System.out.println("THE REQIEST BODY IS" + requestBody);
                      body = requestBody.getBytes("UTF-8");
                  } catch (UnsupportedEncodingException e) {
                      Log.e("TAG", "Unable to gets bytes from JSON", e.fillInStackTrace());
                  }
                  return body;
              }
          };
  
          AppApplication.getInstance().addToRequestQueue(stringRequest, "assignment");
      } catch (Exception e) {
  
      }
  }
  
  
  public void fnCallCateGoryAPI(){
  try { final String URL ="https://www.live.com/shop/api/api.php?m=getcategories"; 
      StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              String strResponse = response;
              System.out.println("THE RESPONSE IS in PROFILE IS" + response);
              JSONObject jsonObj = null;
              try {
                  jsonObj = new JSONObject(strResponse);
                  sessionID = jsonObj.optString("session_id");
                  System.out.print("sessionID" + sessionID);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
      },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                  }
              })
      {
        };
  
      AppApplication.getInstance().addToRequestQueue(stringRequest, "assignment");
  } catch (Exception e) {}
  }}
  </code></pre>