I'll repost all my question because I descovered the problem is the SSL access as pointed by a user here. So I already don't received more 308 message, but my ESP8266 crashes wen I try to access any "https" website.
I'm using this code to try to access:
const char* endpoint = "https://hvilela.com:443/api/data/all";
void onClientStateChange(void* arguments,
asyncHTTPrequest* aReq,
int readyState) {
Serial.println(readyState);
switch (readyState) {
case 0:
// readyStateUnsent // Client created, open not yet called
break;
case 1:
// readyStateOpened // open() has been called, connected
break;
case 2:
// readyStateHdrsRecvd // send() called, response headers available
break;
case 3:
// readyStateLoading // receiving, partial data available
break;
case 4:
// readyStateDone // Request complete, all data available.
#ifdef SERIAL_DEBUG
Serial.println(aReq->responseHTTPcode());
#endif
if (aReq->responseHTTPcode() != 200) {
#ifdef SERIAL_DEBUG
Serial.println("return");
#endif
return;
}
String response = aReq->responseText();
#ifdef SERIAL_DEBUG
Serial.println(response.c_str());
#endif
break;
}
}
void setupClient() {
String URL2 = endpoint;
client2.setTimeout(5);
client2.setDebug(true);
client2.onReadyStateChange(onClientStateChange);
client2.open("GET", URL2.c_str());
client2.send();
delay(1000);
Serial.println("[Client setup end]");
}
by accessing this endpoint, I need to receive a 410 Unauthorized message. Works perfectly in web browsers, but not in ESP8266.
Additionally, I'm using PlatformIO VSCode plugin to program.
The answer of @gre_gor was the key to discover the real problem.
I got the BasicHttps example and started to work, but not completely worked.
I though about a Vercel server problem, but finally, what explained the redirects too, was a 'google-domains' related problem I was having.
hvilela.com is a name on google domains, but inside Vercel this goes to another page (although I don't know why this page was not the Location in 308 advice), and only in this 'inside Vercel' page I could access the API correctly.
Hope this can help who have same problems in future