Reorganise, move code to not be split between haproxy and src folder

This commit is contained in:
Thomas Lynch
2023-02-11 15:06:35 +11:00
parent 0d56079960
commit 08a966c121
23 changed files with 15 additions and 15 deletions

View File

@ -10,17 +10,17 @@ services:
dockerfile: haproxy/Dockerfile
volumes:
- ./haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg
- ./haproxy/ddos.map:/etc/haproxy/ddos.map
- ./haproxy/hosts.map:/etc/haproxy/hosts.map
- ./haproxy/backends.map:/etc/haproxy/backends.map
- ./haproxy/blocked.map:/etc/haproxy/blocked.map
- ./haproxy/whitelist.map:/etc/haproxy/whitelist.map
- ./haproxy/maintenance.map:/etc/haproxy/maintenance.map
- ./haproxy/trace.txt:/etc/haproxy/trace.txt
- ./src/scripts/:/etc/haproxy/scripts/
- ./src/libs/:/etc/haproxy/libs/
- ./haproxy/js/:/var/www/js/
- ./haproxy/html/maintenance.html:/var/www/html/maintenance.html
- ./haproxy/map/ddos.map:/etc/haproxy/ddos.map
- ./haproxy/map/hosts.map:/etc/haproxy/hosts.map
- ./haproxy/map/backends.map:/etc/haproxy/backends.map
- ./haproxy/map/blocked.map:/etc/haproxy/blocked.map
- ./haproxy/map/whitelist.map:/etc/haproxy/whitelist.map
- ./haproxy/map/maintenance.map:/etc/haproxy/maintenance.map
- ./haproxy/template/maintenance.html:/etc/haproxy/maintenance.html
- ./haproxy/template/trace.txt:/etc/haproxy/trace.txt
- ./src/lua/scripts/:/etc/haproxy/scripts/
- ./src/lua/libs/:/etc/haproxy/libs/
- ./src/js/:/etc/haproxy/js/
environment:
# These are the hcaptcha and recaptcha test keys, not leaking any dont worry :^)
- HCAPTCHA_SITEKEY=20000000-ffff-ffff-ffff-000000000002

View File

@ -65,13 +65,13 @@ frontend http-in
acl ddos_mode_enabled base,map(/etc/haproxy/ddos.map) -m bool
# serve challenge page scripts directly from haproxy
http-request return file /var/www/js/argon2.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/argon2.js }
http-request return file /var/www/js/challenge.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/challenge.js }
http-request return file /var/www/js/worker.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/worker.js }
http-request return file /etc/haproxy/js/argon2.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/argon2.js }
http-request return file /etc/haproxy/js/challenge.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/challenge.js }
http-request return file /etc/haproxy/js/worker.js status 200 content-type "application/javascript; charset=utf-8" hdr "cache-control" "public, max-age=300" if { path /.basedflare/js/worker.js }
# acl for domains in maintenance mode to return maintenance page (after challenge page htp-request return rules, for the footerlogo)
acl maintenance_mode hdr(host),lower,map_str(/etc/haproxy/maintenance.map) -m found
http-request return lf-file /var/www/html/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "cache-control" "private, max-age=30" if maintenance_mode
http-request return lf-file /etc/haproxy/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "cache-control" "private, max-age=30" if maintenance_mode
# create acl for bools updated by lua
acl captcha_passed var(txn.captcha_passed) -m bool