ESP32 has been refused by HTTPS connection
Posted: 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
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?
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();
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?