README (3226B)
1 PLAPROX - A proxy for plausible.io scripts 2 ========================================== 3 Plaprox is a *NIX proxy demeon for Plausible scripts. 4 5 6 Raison d'etre 7 ------------- 8 I run my personal homepage under https://michal.sapka.me. I have chosen Plausible 9 (https://plausible.io) as my provider of visitor stats as it gives me all I want 10 while not trying to track visitors - as some other competitors do. 11 12 However, many cybernauts use adblockers. I certainly do. Sometimes those blockers 13 are overprotective and block all stats providers - like Plausible. I consider 14 Plausible as a very much Ok service. To see who actually visits my sites, I need 15 to proxy all requests to Plausible via a local proxy. 16 17 You can read more at https://plausible.io/docs/proxy/introduction. 18 19 I have done it for quite some time, but recently I've moved from Linux/Nginx to 20 OpenBSD/Httpd/Relayd. I love this setup, but it does not provide proxy_pass. 21 22 So I wrote this little fella. 23 24 License 25 ------- 26 Refer to LICENSE 27 28 29 Architecture 30 ------------ 31 Not much here. It's a *NIX daemon that listens on port 9090 and will proxy 32 predefined paths to Plausible and return the returned data back to the user. 33 34 35 Go 36 -- 37 I am not a Go developer. Far from it, as I come from Ruby background. This means 38 that this is not a proper Go code. I've been learning the language a bit before 39 starting to write Plaprox, and this is my first (and, as of writing this - the 40 only) project written in Go. Just for teh lulz. 41 42 43 Contributing 44 ------------ 45 Found this interesting? Cool! Know how to improve things? Even better! Email me 46 a git patch - my email can be found at https://michal.sapka.me/about/. 47 48 Telling me how to do Go properly is also an option. 49 50 51 Known problems and ideas 52 ----------------------- 53 - GET requests can be cached. Plaprox does not currently do this. 54 - Script will break when handling gzip responses. For now we remove headers, so 55 Plausible will not compress response. It would be cool to work with gzip and 56 return gzip if requestes. 57 - An option to force not running as a deamon would be nice. Currently one needs 58 to uncomment two lines in code. 59 - An option to set port. Currently one needs to modify the code. 60 - An option to define location of logs. 61 62 63 Testing 64 ------- 65 You can run the tests via: 66 67 go test 68 69 Please note that I run this on my server running OpenBSD. No other OS is tested. 70 71 Compiling 72 --------- 73 You need Go to compile Plaproxy. After that, compiling is simple: 74 75 go build 76 77 Note that, as for, now I do not provide binary files. You need do perform the 78 compilation on the same OS and architecture as the target system. So, if you run 79 Plaprox on OpenBSD ARM64, compile it on OpenBSD ARM64. 80 81 82 Running 83 ------- 84 You can run the app as a process: 85 86 ./plaprox 87 88 But the preferred way is to treat it a daemon. Please refer to documentation of 89 your OS of choice 90 91 92 Configuration 93 ------------- 94 To proxy other endpoints, you need to modify the source code. Look at method 95 serveProxy() in main.go. Add another handleFunc for the required path, and any 96 requests to the proxy will be handled automatically: 97 98 http.HandleFunc("/another/proxied/path.js", Proxy) 99 100 Donate 101 ----- 102 Want to donate? Great! Try to find a good cause, like OpenBSD fundation.