WiFiClientSecure doesn't connect to HTTPS sites when a static IP is set

Hi to all!

I have a problem with WiFiClientSecure it can’t make a connection to HTTPS sites (specifically “maker.ifttt.com”) when a static IP is set withWiFi.config(IP, gateway, subnet); but if I let the DHCP server to assign the IP it works ok, see this minimal example:

Board: Lolin D1 mini Pro (ESP8266)

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>

// Network Configurations
#define WLAN_SSID     "YOUR_WIRELESS_SSID"
#define WLAN_PASSWORD "YOUR_PASSWORD"

//Connection to HTTPS sites doesn't work with static IP
IPAddress ip(192,168,0,102);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);

void setup() {
  Serial.begin(115200);
  delay(10);
  
  // Connect to WiFi network
  Serial.println(); Serial.println();
  Serial.print("Connecting to ");
  Serial.println(WLAN_SSID);
  
  WiFi.config(ip, gateway, subnet);
  WiFi.mode(WIFI_STA);
  WiFi.begin(WLAN_SSID, WLAN_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println();
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  // connect to HTTPS site
  WiFiClientSecure client;
  client.setInsecure();
  if (client.connect("maker.ifttt.com", 443))
  {
    Serial.println("Connected To Maker");
  }
  else Serial.println("Failed To Connect To Maker!");
}

void loop() {
}

I just have begun programming with Arduino so I’m not sure if this is a bug or if I’m doing something wrong, please give me your opinion.

EDIT: Since I have no responses here, I have taken the risk to assume this is a bug and filed a GH issue here https://github.com/esp8266/Arduino/issues/6957

What address does DHCP give you?

Does it work if you use that address as your static one?

My first suspicion would be that some other device is using the 102 address. Ping it and see.

I was curious on this and checked the OP's link. This was the reply he got ...

"You haven't set a DNS server. Add dns1 and dns2 params (can be the same) to WiFi.config and it runs fine.

WiFi.config(ip, gateway, subnet, gateway, gateway); , for example"

quite interesting for me,
something worth noting for those who didn't know.