150 lines
4.6 KiB
INI
150 lines
4.6 KiB
INI
global
|
|
# This because haproxy is dumb and likes to use the maxconnection from the kernel and that is super mega huge making haproxy oom
|
|
maxconn 16384
|
|
# 777 perms for all sockets
|
|
unix-bind mode 777
|
|
stats socket ipv4@0.0.0.0:8405 level admin
|
|
|
|
resolvers docker
|
|
# To be able to use multiple replicas of invidious
|
|
# using domains
|
|
nameserver dns1 127.0.0.11:53
|
|
|
|
defaults
|
|
mode http
|
|
# https://www.haproxy.com/documentation/haproxy-configuration-tutorials/service-reliability/retries/
|
|
# Use another server if one takes too long to reply
|
|
retries 2
|
|
option redispatch
|
|
timeout client 30s
|
|
timeout connect 5s
|
|
timeout server 30s
|
|
timeout queue 10s
|
|
http-reuse always
|
|
|
|
# Prometheus for graphs
|
|
frontend prometheus
|
|
bind *:8404
|
|
mode http
|
|
http-request use-service prometheus-exporter if { path /metrics }
|
|
no log
|
|
|
|
frontend stats
|
|
mode http
|
|
bind *:8405
|
|
stats enable
|
|
stats uri /stats
|
|
stats refresh 1s
|
|
stats admin if TRUE
|
|
|
|
cache invidious-thumbnail-cache
|
|
# 96MB
|
|
total-max-size 96
|
|
# 32kB
|
|
max-object-size 32768
|
|
# 30min
|
|
max-age 1800
|
|
process-vary on
|
|
|
|
cache invidious-ggpht-cache
|
|
# 96MB
|
|
total-max-size 96
|
|
# 32kB
|
|
max-object-size 32768
|
|
# 1h
|
|
max-age 3600
|
|
process-vary on
|
|
|
|
cache invidious-sb-cache
|
|
# 128MB
|
|
total-max-size 128
|
|
# 128kB
|
|
max-object-size 131072
|
|
# 1h
|
|
max-age 86400
|
|
process-vary on
|
|
|
|
frontend invidious
|
|
http-request set-var(txn.ipath) path
|
|
bind *:8001
|
|
default_backend invidious
|
|
|
|
frontend invidious-tor
|
|
http-request set-var(txn.ipath) path
|
|
bind *:8002
|
|
default_backend invidious-tor
|
|
|
|
frontend invidious-i2p
|
|
http-request set-var(txn.ipath) path
|
|
bind *:8003
|
|
default_backend invidious-i2p
|
|
|
|
frontend http3-proxy
|
|
http-request set-var(txn.hpath) path
|
|
bind *:8004
|
|
default_backend http3-proxy
|
|
|
|
backend invidious
|
|
balance roundrobin
|
|
|
|
# Caches video storyboards
|
|
http-request cache-use invidious-sb-cache if { path_beg /sb/ }
|
|
http-response cache-store invidious-sb-cache
|
|
|
|
# https://discourse.haproxy.org/t/http-response-set-header-with-condition-not-working/3108
|
|
acl sb var(txn.ipath) -m beg /sb/
|
|
|
|
http-response set-header X-Cache-Status HIT if !{ srv_id -m found } sb
|
|
http-response set-header X-Cache-Status MISS if { srv_id -m found } sb
|
|
|
|
server invidious-1-vpn gluetun:3000 check init-addr libc,none
|
|
server invidious-2-vpn gluetun:3001 check init-addr libc,none
|
|
server invidious-3-vpn gluetun:3002 check init-addr libc,none
|
|
server invidious-4-vpn gluetun:3003 check init-addr libc,none
|
|
server invidious-5-vpn gluetun:3004 check init-addr libc,none
|
|
server invidious-6-vpn gluetun:3005 check init-addr libc,none
|
|
|
|
backend invidious-tor
|
|
# Caches video storyboards
|
|
http-request cache-use invidious-sb-cache if { path_beg /sb/ }
|
|
http-response cache-store invidious-sb-cache
|
|
|
|
# https://discourse.haproxy.org/t/http-response-set-header-with-condition-not-working/3108
|
|
acl sb var(txn.ipath) -m beg /sb/
|
|
|
|
http-response set-header X-Cache-Status HIT if !{ srv_id -m found } sb
|
|
http-response set-header X-Cache-Status MISS if { srv_id -m found } sb
|
|
|
|
server invidious-tor-vpn gluetun:3010 check init-addr libc,none
|
|
|
|
backend invidious-i2p
|
|
# Caches video storyboards
|
|
http-request cache-use invidious-sb-cache if { path_beg /sb/ }
|
|
http-response cache-store invidious-sb-cache
|
|
|
|
# https://discourse.haproxy.org/t/http-response-set-header-with-condition-not-working/3108
|
|
acl sb var(txn.ipath) -m beg /sb/
|
|
|
|
http-response set-header X-Cache-Status HIT if !{ srv_id -m found } sb
|
|
http-response set-header X-Cache-Status MISS if { srv_id -m found } sb
|
|
|
|
server invidious-i2p-vpn gluetun:3011 check init-addr libc,none
|
|
|
|
backend http3-proxy
|
|
# Caches video thumbnails, profile pictures and others
|
|
http-request cache-use invidious-thumbnail-cache if { path_beg /vi/ }
|
|
http-response cache-store invidious-thumbnail-cache
|
|
http-request cache-use invidious-ggpht-cache if { path_beg /ggpht/ }
|
|
http-response cache-store invidious-ggpht-cache
|
|
|
|
# https://discourse.haproxy.org/t/http-response-set-header-with-condition-not-working/3108
|
|
acl youtube_thumbnails var(txn.hpath) -m beg /vi/
|
|
acl youtube_ggpht var(txn.hpath) -m beg /ggpht/
|
|
|
|
http-response set-header X-Cache-Status HIT if !{ srv_id -m found } youtube_thumbnails
|
|
http-response set-header X-Cache-Status MISS if { srv_id -m found } youtube_thumbnails
|
|
http-response set-header X-Cache-Status HIT if !{ srv_id -m found } youtube_ggpht
|
|
http-response set-header X-Cache-Status MISS if { srv_id -m found } youtube_ggpht
|
|
|
|
server http3-proxy-1-vpn gluetun:8080 check init-addr libc,none
|
|
|