<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Unable to request HTTPS endpoint with LAN Module 13.2]]></title><description><![CDATA[<p dir="auto"><strong>General informations :</strong></p>
<ul>
<li>M5Stack Core 2</li>
<li>LAN Module 13.2</li>
<li>Using PlatformIO with platform=platformio/espressif32@^6.9.0 &amp; board=m5stack-core2</li>
<li>M5Stack powered by USB-C</li>
</ul>
<p dir="auto"><strong>Problem :</strong><br />
I need to make requests to a secure HTTPS server. They work perfectly on WiFi with the <em>“WiFiClientSecure”</em> client and the <em>“WiFiClient”</em> + <em>“SSLClientESP32”</em> client, but not with <em>“EthernetClient”</em> of <em>“M5Module_LAN”</em> or <em>“Ethernet”</em> + <em>“SSLClientESP32”</em>.</p>
<p dir="auto">I've tried many modules and libraries without getting HTTPS to work, HTTP works in ethernet but is completely useless and outdated. Do you know a way to solve this problem? It shouldn't be so complicated to connect to a site using TLS in 2024.</p>
<p dir="auto"><strong>Here are some sample codes I've tried :</strong></p>
<pre><code>#include &lt;WiFi.h&gt;
#include &lt;WiFiClientSecure.h&gt;
#include &lt;HTTPClientGeneric.h&gt;
#include &lt;SPI.h&gt;

char ssid[] = "ssid";
char pass[] = "password";

WiFiClientSecure wifi;

void setup()
{
 Serial.begin(115200);
 WiFi.begin(ssid, pass);
 uint16_t timeout = 0;
 while (WiFi.status() != WL_CONNECTED)
 {
   if (timeout &gt; 600)
   {
     Serial.println(" Timeout reached, aborting");
   }
   delay(100);
   Serial.print(".");
   timeout++;
 }
 Serial.println(" Connection established!");
 Serial.println("Network::connectWifi(): IP address   : " + WiFi.localIP().toString());
 Serial.println("Network::connectWifi(): Subnet mask  : " + WiFi.subnetMask().toString());
 Serial.println("Network::connectWifi(): Gateway IP   : " + WiFi.gatewayIP().toString());
 Serial.println("Network::connectWifi(): DNS          : " + WiFi.dnsIP().toString());
 Serial.println("Network::connectWifi(): SSID         : " + WiFi.SSID());
 Serial.println("Network::connectWifi(): Signal       : " + String(WiFi.RSSI()) + " dBm");
 wifi.setInsecure(); // Just trying to connect, will use certificate later
}

void loop()
{
 HTTPClientGeneric https;
 https.begin(wifi, " [URL of my HTTPS endpoint] ");
 int httpCode = https.GET();
 Serial.print("GET Status code: ");
 Serial.println(httpCode);
 String response = https.getString();
 Serial.println("Response:");
 Serial.println(response);
 delay(5000);
}
</code></pre>
<p dir="auto">This one works perfectly, the local IP and the response are displayed in the serial port.</p>
<pre><code>#include &lt;WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;HTTPClientGeneric.h&gt;
#include &lt;SSLClientESP32.h&gt;
#include &lt;SPI.h&gt;

char ssid[] = "ssid";
char pass[] = "password";

const char *isrg_root_ca = "-----BEGIN CERTIFICATE-----\n"
                           "...\n"
                           "-----END CERTIFICATE-----\n";

WiFiClient wifi;
SSLClientESP32 ssl_client(&amp;wifi);

void setup()
{
  Serial.begin(115200);
  WiFi.begin(ssid, pass);
  uint16_t timeout = 0;
  while (WiFi.status() != WL_CONNECTED)
  {
    if (timeout &gt; 600)
    {
      Serial.println(" Timeout reached, aborting");
    }
    delay(100);
    Serial.print(".");
    timeout++;
  }
  Serial.println(" Connection established!");
  Serial.println("Network::connectWifi(): IP address   : " + WiFi.localIP().toString());
  Serial.println("Network::connectWifi(): Subnet mask  : " + WiFi.subnetMask().toString());
  Serial.println("Network::connectWifi(): Gateway IP   : " + WiFi.gatewayIP().toString());
  Serial.println("Network::connectWifi(): DNS          : " + WiFi.dnsIP().toString());
  Serial.println("Network::connectWifi(): SSID         : " + WiFi.SSID());
  Serial.println("Network::connectWifi(): Signal       : " + String(WiFi.RSSI()) + " dBm");
  ssl_client.setCACert(isrg_root_ca);
  ssl_client.setInsecure(); // Same
}

void loop()
{
  HTTPClientGeneric https;
  https.begin(ssl_client, " [URL of my HTTPS endpoint] ");
  int httpCode = https.GET();
  Serial.print("GET Status code: ");
  Serial.println(httpCode);
  String response = https.getString();
  Serial.println("Response:");
  Serial.println(response);
  delay(5000);
}
</code></pre>
<p dir="auto">This one works perfectly, the local IP and the response are displayed in the serial port.</p>
<pre><code>#include &lt;M5Unified.h&gt;
#include &lt;M5Module_LAN.h&gt;
#include &lt;WifiClient.h&gt;

#include &lt;HTTPClientGeneric.h&gt;
#include &lt;SSLClientESP32.h&gt;
#include &lt;SPI.h&gt;

byte mac[] = (mac);
Client *client;
EthernetClient ethClient;
SSLClientESP32 ssl_client(&amp;ethClient);

void setup()
{
  M5.begin();
  Serial.begin(115200);
  M5Module_LAN LAN;

  uint8_t cs_pin;
  uint8_t rst_pin;
  uint8_t int_pin;

  m5::board_t board = M5.getBoard();
  switch (board)
  {
  case m5::board_t::board_M5Stack:
  {
    cs_pin = 5;
    rst_pin = 0;
    int_pin = 35;
  }
  break;
  case m5::board_t::board_M5StackCore2:
  {
    cs_pin = 33;
    rst_pin = 0;
    int_pin = 35;
  }
  break;
  case m5::board_t::board_M5StackCoreS3:
  {
    cs_pin = 1;
    rst_pin = 0;
    int_pin = 10;
  }
  break;
  }

  SPI.begin(SCK, MISO, MOSI, -1);

  LAN.setResetPin(rst_pin);
  LAN.reset();
  LAN.init(cs_pin);

  while (LAN.begin(mac) != 1)
  {
    Serial.println("Error getting IP address via DHCP, trying again...");
    delay(2000);
  }
  Serial.println(" Connection established!");
  Serial.println("Network::connectWifi(): IP address   : " + LAN.localIP().toString());
  Serial.println("Network::connectWifi(): Subnet mask  : " + LAN.subnetMask().toString());
  Serial.println("Network::connectWifi(): Gateway IP   : " + LAN.gatewayIP().toString());
  Serial.println("Network::connectWifi(): DNS          : " + LAN.dnsServerIP().toString());
  ssl_client.setCACert(isrg_root_ca);
}

void loop()
{
  HTTPClientGeneric https;
  https.begin(ssl_client, " [URL of my HTTPS endpoint] ");
  int httpCode = https.GET();
  Serial.print("GET Status code: ");
  Serial.println(httpCode);
  String response = https.getString();
  Serial.println("Response:");
  Serial.println(response);
  delay(5000);
}
</code></pre>
<p dir="auto">It does not work with the following error:</p>
<pre><code>[ 20591][E][ssl_lib_client.cpp:35] _handle_error(): [start_ssl_client():300]: (-1) ERROR - Generic error
[ 20601][E][SSLClientESP32.cpp:123] connect(): start_ssl_client: -1
[ 21775][E][ssl_lib_client.cpp:35] _handle_error(): [start_ssl_client():300]: (-1) ERROR - Generic error
[ 21784][E][SSLClientESP32.cpp:123] connect(): start_ssl_client: -1
</code></pre>
<p dir="auto">Note that the IP is displayed correctly. It works with the EthernetClient but the request is HTTP only, so not what I want.</p>
]]></description><link>https://community.m5stack.com/topic/6924/unable-to-request-https-endpoint-with-lan-module-13-2</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 14:46:28 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6924.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Oct 2024 10:15:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Unable to request HTTPS endpoint with LAN Module 13.2 on Fri, 25 Oct 2024 08:22:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a> Thanks it works perfectly with the "<em>ESP_SSLClient</em>" module instead of "<em>SSLClientESP32</em>" !</p>
]]></description><link>https://community.m5stack.com/post/26845</link><guid isPermaLink="true">https://community.m5stack.com/post/26845</guid><dc:creator><![CDATA[msauv]]></dc:creator><pubDate>Fri, 25 Oct 2024 08:22:48 GMT</pubDate></item><item><title><![CDATA[Reply to Unable to request HTTPS endpoint with LAN Module 13.2 on Thu, 24 Oct 2024 14:51:00 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/175299">@msauv</a></p>
<p dir="auto">have you looked at this <a href="https://github.com/mobizt/ESP_SSLClient/blob/main/examples/Ethernet/Ethernet.ino" target="_blank" rel="noopener noreferrer nofollow ugc">example</a> from the ESP_SSLClient library? Works for me.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/26836</link><guid isPermaLink="true">https://community.m5stack.com/post/26836</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 24 Oct 2024 14:51:00 GMT</pubDate></item></channel></rss>