11 years, 1 month ago.

HTTP server does not open html files

hi my http server does not open any html files except for the default mbed.htm. I have got a txt file "config.txt" and a html file "config.html" on my local system stored. But as I try to open http://myip/files/config.html the browser only says "File not found". When I ask for the txt file the textfile appears.

What am I doing wrong?

Heres my code:

  1. include "mbed.h"
  2. include "EthernetNetIf.h"
  3. include "HTTPServer.h"

DigitalOut led1(LED1, "led1");

LocalFileSystem fs("webfs");

EthernetNetIf eth( IpAddr(192,168,1,22), IpAddr(255,255,255,0), IpAddr(192,168,0,1), IpAddr(192,168,0,1) ); HTTPServer svr;

int main() {

printf("Setting up...\n"); EthernetErr ethErr = eth.setup(); if(ethErr) { printf("Error %d in setup.\n", ethErr); return -1; } printf("Setup OK\n");

FSHandler::mount("/webfs", "/files"); Mount /webfs path on /files web path FSHandler::mount("/webfs", "/"); Mount /webfs path on web root path

svr.addHandler<FSHandler>("/files"); svr.addHandler<FSHandler>("/"); Default handler Example : Access to mbed.htm : http://a.b.c.d/mbed.htm or http://a.b.c.d/files/mbed.htm

svr.bind(80);

printf("Listening...\n");

led1 = 1; Listen indefinitely while(true) { Net::poll();

}

return 0;

}

Hi Benjamin, you will probably get better answers to your question if you publish your program and share it with your question. - See http://mbed.org/handbook/Asking-Questions

posted by Dan Ros 01 Mar 2013

1 Answer

11 years, 1 month ago.

Hi Benjamin, local file system support only 8.3 file format. Rename Config.html -> Config.htm....