ESPAsyncWebServer + Husarnet

Hi.

I’m trying to use ESPAsyncWebServer library using this simple web server example.

This is the resulting code:

#include "Arduino.h"
#include <WiFi.h>
#include <Husarnet.h>
//#include <WebServer.h>
#include "AsyncTCP.h"
#include "ESPAsyncWebServer.h"

// WiFi credentials
const char* ssid     = "------";
const char* password = "----------------";

// Husarnet credentials
const char* hostName = "----------------";
const char* husarnetJoinCode = "------------------------------";
const char* dashboardURL = "default";

// Setup http server
AsyncWebServer server(8000);



void setup() {
  Serial.begin(115200);

  // Connect to Wi-Fi
  Serial.printf("Connecting to %s", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.printf("done!\r\nLocal IP: %s\r\n", WiFi.localIP().toString().c_str());

  // Start Husarnet
  Husarnet.selfHostedSetup(dashboardURL);
  Husarnet.join(husarnetJoinCode, hostName);
  Husarnet.start();

  // Configure http server
server.on("/index.html", HTTP_GET, [] (AsyncWebServerRequest * request) {
    AsyncWebServerResponse *response = request->beginResponse(200, "text/html", "<html><head></head><body>Hello World!</body></html>");
    request->send(response);
  });

  server.begin();
}

void loop() {
}

app.husarnet.com shows the connected device and all its parameters:
name - status - address - info
but never shows an available web server under “info” column

The code works well when accessing inside the local network: 192.168.1.X:8000 but not when using https://-----------------------------------------------8000.husarnetusers.com/index.html
Firefox allways shows: 502 Bad Gateway

Today, it works and i don’t know why