Page 1 of 1

OTA Update with HTTPS problem.

Posted: Thu Jun 21, 2018 5:51 am
by kd.spide
Hi,
I am planning to make ota update using https for esp32. So, my setup is like it connects to my secure Mqtt broker. OTA is triggering in particular topic.
I am using ESP-IDF and this example https://github.com/espressif/esp-idf/tr ... ystem/ota.
I have changed the connectivity part to https referring to https_request example https://github.com/espressif/esp-idf/tr ... ps_request.The connectivity is successful. But after that get request is having error

Code: Select all

I (20485) ota: Connected to AP
I (21685) ota: Connection established...
I (21685) ota: Connected to http server 
E (21685) ota: Send GET request to server failed 
E (21685) ota: Exiting task due to fatal error...
How can i further get data and set that data to OTA update?

Re: OTA Update with HTTPS problem.

Posted: Thu Jun 21, 2018 7:52 pm
by chegewara
My suggestion is to setup your esp32 to ota from local network and if it works test with curl if you can get access ota file on external address. My first OTA app issue was missing slash:
https://github.com/espressif/esp-idf/is ... -345897991

Re: OTA Update with HTTPS problem.

Posted: Thu Jun 21, 2018 11:56 pm
by fly135
Ima just throwing this out. When I originally tried to do https to a server (wasn't OTA) I had the same problem. Seems like I did two things and it started working. The one I remember was changing HTTP/1.0 to HTTP/1.1

The other was.. ummm not sure I did anything else. If this sounds vague and silly, well yeah. But if you change that 0 to a 1 and it works I'd like to hear about it.

Your probably wondering why I didn't try and backtrack to verify. I think I was getting tired of looking at that problem. Maybe I will. But we're in a rush to get some stuff done, so I'll probably remember the next time someone else posts this problem. But the title could be better worded because it has nothing to with OTA itself.

John A

Re: OTA Update with HTTPS problem.

Posted: Fri Jun 22, 2018 12:01 am
by Daniel

Re: OTA Update with HTTPS problem.

Posted: Fri Jun 22, 2018 5:40 am
by kd.spide
chegewara wrote:My suggestion is to setup your esp32 to ota from local network and if it works test with curl if you can get access ota file on external address. My first OTA app issue was missing slash:
https://github.com/espressif/esp-idf/is ... -345897991
I have tested it with http. It is working fine. so no issue in connectivity and also i have tried to access it with different machine in network.

Re: OTA Update with HTTPS problem.

Posted: Fri Jun 22, 2018 10:18 am
by kd.spide
fly135 wrote:Ima just throwing this out. When I originally tried to do https to a server (wasn't OTA) I had the same problem. Seems like I did two things and it started working. The one I remember was changing HTTP/1.0 to HTTP/1.1

The other was.. ummm not sure I did anything else. If this sounds vague and silly, well yeah. But if you change that 0 to a 1 and it works I'd like to hear about it.

Your probably wondering why I didn't try and backtrack to verify. I think I was getting tired of looking at that problem. Maybe I will. But we're in a rush to get some stuff done, so I'll probably remember the next time someone else posts this problem. But the title could be better worded because it has nothing to with OTA itself.

John A
It actually worked. 1.1 was the fix. Now OTA is working. Is it possible to add client cert and key along with CA certificate also in https?

Re: OTA Update with HTTPS problem.

Posted: Fri May 01, 2020 7:33 am
by sarapatel
Hi can anyone please help me with how should I test the existing OTA example via HTTPS? I tried to use the command " openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 -nodes" its saying 'openssl' is not recognized as an internal or external command,operable program or batch file. and when I use winpty then also the same error it shows.So can anyone guide me ?

Re: OTA Update with HTTPS problem.

Posted: Fri May 01, 2020 11:18 am
by sarapatel
Hi, I am getting the following error :
simple_ota_example: Starting OTA example
E (34447) esp-tls: Failed to connnect to host (errno 113)
E (34447) esp-tls: Failed to open new connection
E (34447) TRANS_SSL: Failed to open a new connection
E (34447) HTTP_CLIENT: Connection failed, sock < 0
E (34457) esp_https_ota: Failed to open HTTP connection: ESP_ERR_HTTP_CONNECT
E (34457) esp_https_ota: Failed to establish HTTP connection
E (34467) simple_ota_example: Firmware upgrade failed

how should I move forward? please guide.