Page 1 of 1

ESP32 has been refused by HTTPS connection

Posted: Thu Oct 10, 2024 10:56 am
by tankist
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?

Re: ESP32 has been refused by HTTPS connection

Posted: Wed Oct 16, 2024 4:24 am
by lbernstone
https://github.com/espressif/arduino-es ... Client.ino
You must supply a certificate, or tell NetworkClientSecure to setInsecure.