ESP32 has been refused by HTTPS connection

tankist
Posts: 14
Joined: Tue Feb 08, 2022 7:22 am

ESP32 has been refused by HTTPS connection

Postby tankist » Thu Oct 10, 2024 10:56 am

I use https://github.com/earlephilhower/ESP8266Audio library for listening web radio streams. It works pretty well except the case I try to connect to HTTPS servers instead of HTTP. In my country almost no radio broadcasting via HTTP, all station use HTTPS.
I found out the problem is in HTTP request. It looks like

Code: Select all

  HTTPClient http;
  ...
  bool res = http.begin(client, url);
  http.addHeader("Icy-MetaData", "1");
  http.collectHeaders( hdr, 4 );
  http.setReuse(true);
  http.setFollowRedirects(HTTPC_FORCE_FOLLOW_REDIRECTS);
  int code = http.GET();
And after that http.GET() returns -1 that means HTTPC_ERROR_CONNECTION_REFUSED. "client" has type as NetworkClient and it has no any methods to set certificate as I found out. All examples I found only concern WiFiClientSecure class so I do'n know if it's the issue of the certificate or not.

The example requested URL is "https://stream2.datacenter.by/radiomir" and it work well in my desktop audio player.

Any suggestions how to fix that?

lbernstone
Posts: 831
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 has been refused by HTTPS connection

Postby lbernstone » Wed Oct 16, 2024 4:24 am

https://github.com/espressif/arduino-es ... Client.ino
You must supply a certificate, or tell NetworkClientSecure to setInsecure.

Who is online

Users browsing this forum: No registered users and 36 guests