From 013f9222f3134460a43fd79446b59237916cf0c3 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 1 Mar 2024 16:09:56 -0300 Subject: Setup user-level lighttpd reverse proxy for development and testing Add static files as in production, too. --- Makefile | 6 ++++- src/static/client.js | 0 src/static/favicon.svg | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/static/index.html | 27 ++++++++++++++++++++++ src/static/styles.css | 0 tests/lighttpd.conf | 32 ++++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 src/static/client.js create mode 100644 src/static/favicon.svg create mode 100644 src/static/index.html create mode 100644 src/static/styles.css create mode 100644 tests/lighttpd.conf diff --git a/Makefile b/Makefile index e0789d3..fce3ce3 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,7 @@ derived-assets = \ side-assets = \ tests/hero-0.sock \ tests/hero-1.sock \ + lighttpd.sock \ ircd.sock \ web.sock \ @@ -142,9 +143,12 @@ run-web: all rm -f web.sock ./src/bin.mjs web web.sock +run-proxy: all + lighttpd -Df tests/lighttpd.conf + ## Run the web and IRC server locally. run: all - $(MAKE) run-ircd & $(MAKE) run-web & wait + $(MAKE) run-ircd & $(MAKE) run-web & $(MAKE) run-proxy & wait ## Show this help. diff --git a/src/static/client.js b/src/static/client.js new file mode 100644 index 0000000..e69de29 diff --git a/src/static/favicon.svg b/src/static/favicon.svg new file mode 100644 index 0000000..ce566b2 --- /dev/null +++ b/src/static/favicon.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/static/index.html b/src/static/index.html new file mode 100644 index 0000000..b4c5118 --- /dev/null +++ b/src/static/index.html @@ -0,0 +1,27 @@ + + + + + + Papo + + + + + + +

Chat

+
+ + +
+
+ + diff --git a/src/static/styles.css b/src/static/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf new file mode 100644 index 0000000..5438366 --- /dev/null +++ b/tests/lighttpd.conf @@ -0,0 +1,32 @@ +server.modules += ( + "mod_proxy", + "mod_accesslog", +) + +server.bind = var.CWD + "/lighttpd.sock" +server.document-root = var.CWD + "/src/static/" + +server.errorlog = "/dev/stderr" +server.breakagelog = "/dev/stderr" +accesslog.filename = "/dev/stderr" + +accesslog.format = "" +accesslog.format += "{ " +accesslog.format += "\"tool\": " + "\"lighttpd\", " +accesslog.format += "\"http-host\": " + "\"%V\", " +accesslog.format += "\"remote-addr\": " + "\"%h\", " +accesslog.format += "\"remote-user\": " + "\"%u\", " +accesslog.format += "\"request-method\": " + "\"%m\", " +accesslog.format += "\"request\": " + "\"%r\", " +accesslog.format += "\"status\": " + "%s, " +accesslog.format += "\"body-bytes-sent\": " + "\"%b\", " +accesslog.format += "\"duration-usec\": " + "%D, " +accesslog.format += "\"http-referrer\": " + "\"%{Referer}i\", " +accesslog.format += "\"http-user-agent\": " + "\"%{User-Agent}i\" " +accesslog.format += "}" + +index-file.names = ( "index.html" ) + +$HTTP["url"] =~ "^/api/" { + proxy.server = ( "" => (( "host" => var.CWD + "/web.sock" ))) +} -- cgit v1.2.3