diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index 422dd3a0c0..c3f6107fca 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -549,7 +549,8 @@ bool HTTPClient::setURL(const String& url) DEBUG_HTTPCLIENT("[HTTP-Client][setURL] new URL not the same protocol, expected '%s', URL: '%s'\n", _protocol.c_str(), url.c_str()); return false; } - // disconnect but preserve _client + // disconnect but preserve _client (clear _canReuse so disconnect will close the connection) + _canReuse = false; disconnect(true); return beginInternal(url, nullptr); }