ESP8266WebServer - not handling page requests
Posted: Sun Jan 17, 2016 4:57 am
Hi,
I have created a project using arduino 1.6.5 - simple enough just a webserver serving a couple of web pages.
I have created a couple of handlers:
//SERVER INIT
WebServer.on("/", HTTP_GET, handle_root);
WebServer.on("/index", HTTP_GET, handle_root);
WebServer.on("/mode", HTTP_POST, handle_mode);
WebServer.on("/mode", HTTP_GET, handle_mode);
WebServer.on("/tri.png", HTTP_GET, handle_tri);
WebServer.on("/favicon.ico", []() {
WebServer.send(404, "text/plain", "");});
and have the appropriate functions to deal with them.
The problem I am seeing is that when I put a URL into my browser, 10.0.0.1/ works - gets processed by handle_root perfectly.
This also works 10.0.0.1/index and 1.0.0.1/mode also OK
However if I use 10.0.0.1/index.html it jumps to filenotfound.
Is there something I am missing.
My web pages have links like <a href="mode.html"><button type="button" style.....
These cause filenot found behaviour.
Any help appreciated.
I have created a project using arduino 1.6.5 - simple enough just a webserver serving a couple of web pages.
I have created a couple of handlers:
//SERVER INIT
WebServer.on("/", HTTP_GET, handle_root);
WebServer.on("/index", HTTP_GET, handle_root);
WebServer.on("/mode", HTTP_POST, handle_mode);
WebServer.on("/mode", HTTP_GET, handle_mode);
WebServer.on("/tri.png", HTTP_GET, handle_tri);
WebServer.on("/favicon.ico", []() {
WebServer.send(404, "text/plain", "");});
and have the appropriate functions to deal with them.
The problem I am seeing is that when I put a URL into my browser, 10.0.0.1/ works - gets processed by handle_root perfectly.
This also works 10.0.0.1/index and 1.0.0.1/mode also OK
However if I use 10.0.0.1/index.html it jumps to filenotfound.
Is there something I am missing.
My web pages have links like <a href="mode.html"><button type="button" style.....
These cause filenot found behaviour.
Any help appreciated.