aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2025-02-09 18:50:27 +0100
committerOscar Najera <hi@oscarnajera.com>2025-02-09 18:50:27 +0100
commit87ef3a1635aae064bfcfac0be532b9904bdd927d (patch)
tree574c4f5f96989d10d7776c37b5b3c08b82b7db69
parent346dcbecc20802f7bc86b5a8c4ca2d1c4bed37c0 (diff)
downloadscratch-87ef3a1635aae064bfcfac0be532b9904bdd927d.tar.gz
scratch-87ef3a1635aae064bfcfac0be532b9904bdd927d.tar.bz2
scratch-87ef3a1635aae064bfcfac0be532b9904bdd927d.zip
[stats] put behind lighttpd proxy
-rw-r--r--webstats/readme.org20
-rw-r--r--webstats/server.lisp4
-rw-r--r--webstats/stats.paren2
3 files changed, 23 insertions, 3 deletions
diff --git a/webstats/readme.org b/webstats/readme.org
new file mode 100644
index 0000000..d3908e9
--- /dev/null
+++ b/webstats/readme.org
@@ -0,0 +1,20 @@
+#+title: Track website visit statistics
+
+* Setup lighttpd
+On the config file append the proxy to the running lisp server
+#+begin_src conf
+server.modules += ( "mod_proxy" )
+
+$HTTP["url"] =~ "^/stats/" {
+ proxy.server = ("" =>
+ ( "hunchentoot" =>
+ ( "host" => "127.0.0.1",
+ "port" => 4252 )
+ )
+ )
+ proxy.header = (
+ "map-urlpath" => ( "/stats" => "" )
+ )
+
+}
+#+end_src
diff --git a/webstats/server.lisp b/webstats/server.lisp
index 4fecc1f..44dbe89 100644
--- a/webstats/server.lisp
+++ b/webstats/server.lisp
@@ -85,13 +85,13 @@
(:doctype)
(:html
(:header (:title "hu yu ipi")
- (:script :src "/stats.js" :type "text/javascript"))
+ (:script :src "/stats/stats.js" :type "text/javascript"))
(:body
(:p "learning "
(:a :href "vars" "some explodiert")
(:a :href "visit" "count visit"))
- (:form :action "/visit"
+ (:form :action "/stats/visit"
:method "post"
(:input :type "text" :name "title")
(:input :type "submit" :value "submit" :name "submit"))))
diff --git a/webstats/stats.paren b/webstats/stats.paren
index a4f6957..b9d3974 100644
--- a/webstats/stats.paren
+++ b/webstats/stats.paren
@@ -4,7 +4,7 @@
(in-package :webstats-js)
(defun register-visit (data)
- (fetch "http://localhost:4252/visit"
+ (fetch "http://localhost/stats/visit"
(create :method "POST"
:headers (create "Content-Type" "application/x-www-form-urlencoded")
:body (new (-u-r-l-search-params data)))))