HTTPS web service with ESP8266 - ENC28j60

Hi all,

I’m using a ESP8266 with a ENC28j60 to query a web service using ethernet conection (I’m using the <UIPEthernet.h> library), this working ok when the web service is HTTP (The code is below), but when I try query a HTTPS web service (Changind the por 80 by 443) I receive a 400 response (Bad request), whit this message: 400 The plain HTTP request was sent to HTTPS port

I know that arduino uno can’t handle https protocol, but ESP8266 can do it, maybe have I to use another library?

////// HTTP request
if (client.connect(“jsonplaceholder.typicode.com”, 80)) {
Serial.print("connected the Ip address is: ");
Serial.println(Ethernet.localIP());

client.println(“GET /comments?postId=7 HTTP/1.1”);
client.println(“Host: jsonplaceholder.typicode.com”);
client.println(“User-Agent: arduino/1.0”);
client.println((“Connection: close”));
client.println();
} else {
Serial.println(“connection failed”);
}

//// HTTPS reques: the HTTPS reques is equal, 80 only change the port 80 by 443
if (client.connect(“jsonplaceholder.typicode.com”, 443)) {
.
.
.

How can I query a HTTPS web service with ESP8266 and ENC28j60?

Thanks friends

Changing the port does not help. The ‘s’ in https mean it is secure - or encrypted. All communication is encrypted by transport layer security (TLS).

As far as I know there is no library that do it (confuse me if I’m right ;))

" know that arduino uno can't handle https protocol, but ESP8266 can do it, maybe have I to use another library?"

Select a wifi board in the IDE boards selection, then go to the examples in the IDE and look at the ESP8266WiFi examples. There seem to be a number of HTTPS examples available.

the UIPEthernet library can't do it. but there is a work in progress to integrate W5x00 and enc28j60 as possiible network interface in the LWIP TCP stack of the esp8266 Arduino. the it can use same secure layer as the WiFi connection

Juraj, then in this moment there is no any way to send a GET request using Ethernet Conection with an ESP8266?

OnJuanTrack:
Juraj, then in this moment there is no any way to send a GET request using Ethernet Conection with an ESP8266?

HTTPS, not
HTTP, no problem