In my last Blog, I was showing how we can process html forms with the Arduino TinyHttp library. In the examples we were embedding the html into the source code.

Sometimes however it is more convenient to store the html as files on a dedicated server: In the following examples we use Github for this.


In this example we just forward to an external URL.

static Url forward_url("");
server.on("/",GET, forward_url);

This external html page contains logical names (with the serive_url = ‘http://esp32-service/service’) to address the webervice.

Therefore we just needed to add some additional DNS logic into the sketch.

// register the service name
if (!MDNS.begin("esp32-service")) {
    Serial.println("Could not set up DNS");

Github is using a https connection, but the webservice just uses http. This is insecure and we need to change the browser settings to allow this.


In the next example we use tunnelling to an external URL: the forwarding is hidden to the end user.

// forward address
static HttpTunnel tunnel_url("");
server.on("/",GET, tunnel_url);

This is a little bit less efficient then a simple forwarding, but it has the advantage that we do not have to worry about authentication or CORS, and the external html page can use local addressing (with the serive_url = ‘/service’) to specify the services!

Categories: Arduino


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *