     }
  
     Serial.print("Requesting " + action + "... ");
-    action = action + " HTTP/1.0\r\n\r\n";
+    action = action + " HTTP/1.0\r\nHost: " + hostName + "\r\n\r\n";
     wifi.print("AT+CIPSEND=");
     delay(100);
     wifi.println(action.length());



void healthcheck() {
    request(SERVER_ADDRESS, SERVER_PORT, healthcheckAction);
}

void registerEvent() {
    request(SERVER_ADDRESS, SERVER_PORT, eventAction);
}


void request(String host, int port, String action) {
    wifi.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + port);
    delay(2000);
    if (wifi.find("Error")) {

    delay(1000);
    wifi.println("AT+CIPCLOSE");
    Serial.println("ok");

    wifi.flush();
}

boolean connectWiFi() {    
    Serial.print("Connecting... ");
    wifi.begin(9600);

    wifi.println("AT");
    if (!wifi.find("OK")) {
        Serial.println("error connecting module");
        return false;
    }
    
    wifi.println("AT+CIPSTATUS");
    if (wifi.find("STATUS:3") || wifi.find("STATUS:5")) {
        Serial.println("already connected");
        return true;
    }

    wifi.println("AT+RST");
    wifi.println("AT+CWMODE=1");
    delay(1000); //delay after mode change
    wifi.println("AT+CWJAP=\"" + SSID + "\",\"" + PASS + "\"");
    delay(1000);
    if (!wifi.find("OK")) {
        Serial.println("error connecting AP");
