Implement --forward.

A web forward feature that performs 301 redirects for some requests
(in addition normal web content serving)

The "Host:" request header (HTTP/1.1 only) is compared with a list of
hosts, defined by the "--forward host url" option. If a match is found,
the request is redirected to url+path. Otherwise, it is served as a
request to the local file system.
This commit is contained in:
Egor Ivanov
2013-04-20 14:05:27 +04:00
committed by Emil Mikulic
parent 1b10a57f39
commit ab7af194e6
2 changed files with 67 additions and 0 deletions

4
README
View File

@ -45,6 +45,10 @@ Use acceptfilter (FreeBSD only):
Run in the background and create a pidfile:
$ ./darkhttpd /var/www/htdocs --pidfile /var/run/httpd.pid --daemon
Web forward (301) requests for some hosts:
$ ./darkhttpd /var/www/htdocs --forward example.com http://www.example.com \
--forward secure.example.com https://www.example.com/secure
Commandline options can be combined:
$ ./darkhttpd ~/public_html --port 8080 --addr 127.0.0.1