0

hiii, This is for Sending HTTPS POST request to clould function server by using sim800l gprs module.the main problem is its could not send the data to server but its connects the server and its shows bad request 400.I can't understand the problem.the code will be given below.i use NODEMCU-32S micro controller.

SerialMon.println("Performing HTTP POST request...");
String httpRequestData = String(requestBody) +"";
client.print(String("POST ") + resource + " HTTP/1.1\r\n");
client.print(String("Host: ") + server + "\r\n");
client.println("Connection: close");
client.println("Content-Type: application/json");
client.print("Content-Length: ");
client.println(httpRequestData.length());
client.println();
client.println(httpRequestData);


   timeout = millis();
 while (client.connected() && millis() - timeout < 10000L) {
   while (client.available()) {
     char c = client.read();
    SerialMon.print(c);
    timeout = millis();
  }
}

enter image description here <--this is the output image.

please help me to find out the solution.

1 Answers1

0

This is happening because of cloudflare protection on server's end.

Things you can try

  1. Download Cloudflare SSL from your account in your system before doing request
  2. Disable cloudflare end to end SSL verification
  3. Make request from https to https via connecting your Esp32 to a static IP
Kartikey
  • 63
  • 1
  • 7