How to set header with busybox httpd

BusyBox HTTP Daemon (httpd) webserver is an own simple web server implementation without wide configuration options, as you can see from the OpenWRT configuration documentation or the comment block from httpd.c source (lines 39-60):

 * httpd.conf has the following format:
 * H:/serverroot     # define the server root. It will override -h
 * A:172.20.         # Allow address from
 * A:     # Allow any address from
 * A:  # Allow any address that previous set
 * A:       # Allow local loopback connections
 * D:*               # Deny from other IP connections
 * E404:/path/e404.html # /path/e404.html is the 404 (not found) error page
 * I:index.html      # Show index.html when a directory is requested
 * P:/url:[http://]hostname[:port]/new/path
 *                   # When /urlXXXXXX is requested, reverse proxy
 *                   # it to http://hostname[:port]/new/pathXXXXXX
 * /cgi-bin:foo:bar  # Require user foo, pwd bar on urls starting with /cgi-bin/
 * /adm:admin:setup  # Require user admin, pwd setup on urls starting with /adm/
 * /adm:toor:PaSsWd  # or user toor, pwd PaSsWd on urls starting with /adm/
 * /adm:root:*       # or user root, pwd from /etc/passwd on urls starting with /adm/
 * /wiki:*:*         # or any user from /etc/passwd with according pwd on urls...
 * .au:audio/basic   # additional mime type for files
 * *.php:/path/php   # run xxx.php through an interpreter

Your options with BusyBox HTTPd:

  • BusyBox HTTP Daemon is open source. Modify httpd.c to add the header and compile.
  • Have your page served as a cgi script. It can have custom headers at the beginning.

Or install some more versatile web server that has this: Nginx, Apache, Lighttpd...