1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/minimal-http-server
Andy Green b490079b47 vhost: add 404 handler url option
This allows you to set a 404 handler URL on a vhost.

The necessary user code looks like...

    info.error_document_404 = "/404.html";

... at vhost-creation time.

In the existing lws_return_http_status() api, if it sees
the vhost has an "error_document_404" path set and that
we are trying to report a 404, it changes the action
instead to a redirect to the error_document_404 path.

The redirect target is returned using 404 status code.

If the redirect target doesn't exist, then it falls back
to just reporting the simple canned 404.
2018-03-08 09:01:14 +08:00
..
CMakeLists.txt minimal: add Wall and cleanups 2018-03-07 07:05:39 +08:00
favicon.ico minimal-examples: http server 2018-03-04 16:56:40 +08:00
index.html minimal-examples: http server 2018-03-04 16:56:40 +08:00
libwebsockets.org-logo.png minimal-examples: http server 2018-03-04 16:56:40 +08:00
minimal-http-server.c vhost: add 404 handler url option 2018-03-08 09:01:14 +08:00
README.md minimal-examples: http server 2018-03-04 16:56:40 +08:00

lws minimal http server

build

 $ cmake . && make

usage

 $ ./lws-minimal-http-server
[2018/03/04 09:30:02:7986] USER: LWS minimal http server | visit http://localhost:7681
[2018/03/04 09:30:02:7986] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 on

Visit http://localhost:7681