     }
 
     if (request == "tempc") {
-      remoteJSONHeaders();
+      client.println("Status: 200");
+      client.println("Content-type: application/json");
+      client.println("Access-Control-Allow-Origin: *");
+      client.println(); //mandatory blank line
 
       // JSON response
       client.print("{\"type\":\"temperature\",");

    request.trim();   //kill whitespace

    if (request == "tempf") {
      remoteJSONHeaders();

      // JSON response
      client.print("{\"type\":\"temperature\",");

    }

    if (request == "dp") {
      client.println("Status: 200");
      client.println("Content-type: application/json");
      client.println("Access-Control-Allow-Origin: *");
      client.println(); //mandatory blank line

      // JSON response
      client.print("{\"type\":\"index\",");
