SIM7600 HTTPS with TCP/IP AT commands

I have a sim7600A-H and I'm trying to use the Firebase realtime database REST api to send the device's coordinates

The api requires https, so I originally used the AT+HTTP commands to send data. But that only allows GET/POST/HEAD, I need to send a PUT or PATCH to prevent duplicate data with every request in the database

I created a PUT request using the TCP/IP AT commands and X-HTTP-Method-Override: PUT

However, now I get a 400 Bad Request code and "The plain HTTP request was sent to HTTPS port"

Here's the .ino code I'm using to send the PUT request:

  String tcp_data = "POST /path/to/users/simcom.json? HTTP/1.1\n";
  tcp_data = tcp_data + "Host:project-default-rtdb.firebaseio.com\n";
  tcp_data = tcp_data + "X-HTTP-Method-Override: PUT\n";
  tcp_data = tcp_data + "..."; // Json data here

  sendData("AT+NETCLOSE", 2000, DEBUG);
  sendData("AT+CSOCKSETPN=1", 2000, DEBUG);
  sendData("AT+CIPMODE=0", 2000, DEBUG);
  sendData("AT+NETOPEN", 2000, DEBUG);
  sendData("AT+CIPOPEN=0,\"TCP\",\"project-default-rtdb.firebaseio.com\",443", 2000, DEBUG);
  sendData("AT+CIPSEND=0," + String(tcp_data.length()), 2000, DEBUG);
  sendData(tcp_data, 2000, DEBUG);

Couple of side notes if they are of any use:

I strictly followed this tutorial for AT commands: TCP/IP testing with Simcom SIM7500 and SIM7600 Modules | M2MSupport.net

And followed the documentation for the rest api:
https://firebase.google.com/docs/database/rest/save-data

Why don't you just use the PUT method but some non-standard override header? Does you server support that?

That works too, just what I last left off with. But even if I do that, it still causes the https error

Because you open a standard TCP connection. Your module might support TLS connections but I didn't find a manual of the corresponding AT commands, in the 7600 series manual even the AT commands you use above aren't available. So provide a link to the manual of the commands your module supports!

AT+CCHSTART
If you receive OK on UART, then it supports SSL and will enable it.
But I am not sure, maybe for HTTPS connection your need to use some SSL related AT command instead of your actual command that you are using for HTTP.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.