Switch to unix sockets for varnish<->haproxy comms

Remove some cruft from old caching
This commit is contained in:
Thomas Lynch
2024-11-12 19:58:38 +11:00
parent 0d5e39cad1
commit f233c1f06d
3 changed files with 21 additions and 19 deletions

View File

@@ -142,10 +142,6 @@ frontend http-in
#http-request lua.set-lang-json
#http-request return lf-file /etc/haproxy/template/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "Cache-Control" "private, max-age=30" if maintenance_mode
# simple example cache for files
http-request set-var(txn.path) path
acl can_cache var(txn.path) -i -m end .png .jpg .jpeg .jpe .ico .webmanifest .xml .apng .bmp .webp .pjpeg .jfif .gif .mp4 .webm .mov .mkv .svg .m4a .aac .flac .mp3 .ogg .wav .opus .txt .pdf .sid
# optional alt-svc header (done after cache so not set in cached responses
acl match_server_continent var(txn.xcn) -m str "${HAPROXY_CONTINENT}"
http-response set-header X-Server-CN "${HAPROXY_CONTINENT}"
@@ -153,16 +149,16 @@ frontend http-in
http-response set-header Alt-Svc %[var(txn.xcn),map(/etc/haproxy/map/alt-svc.map)] if !match_server_continent
# varnish caching if available
acl varnish_available nbsrv(varnish) gt 0
use_backend varnish if varnish_available
acl varnish_available nbsrv(haproy-to-varnish-cache) gt 0
use_backend haproy-to-varnish-cache if varnish_available
default_backend servers
frontend varnish-to-haproxy-internal
bind 127.0.0.1:8080 user root mode 666
bind unix@/shared-sockets/varnish-to-haproxy-internal.sock user root mode 666
default_backend servers
backend varnish
server CACHE 127.0.0.1:8083 check observe layer7 inter 1s
backend haproy-to-varnish-cache
server CACHE unix@/shared-sockets/haproxy-to-varnish-cache.sock check observe layer7 inter 1s
backend servers
balance leastconn