134 lines
4.3 KiB
INI
134 lines
4.3 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 32768
|
|
# 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
|
|
timeout client 10s
|
|
timeout connect 10s
|
|
timeout server 5s
|
|
timeout http-request 10s
|
|
|
|
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
|
|
# 30min
|
|
max-age 3600
|
|
process-vary on
|
|
|
|
# cache api-cache
|
|
# # 32MB
|
|
# total-max-size 32
|
|
# # 4kB
|
|
# max-object-size 32000
|
|
# # 5min
|
|
# max-age 300
|
|
# process-vary on
|
|
|
|
frontend invidious
|
|
http-request set-var(txn.ggpht) path
|
|
bind /tmp/invidious-vpn.sock
|
|
bind *:8001
|
|
#filter cache invidious-api-cache
|
|
#http-request cache-use invidious-api-cache if { path_beg /api/v1 }
|
|
#http-response cache-store invidious-api-cache
|
|
default_backend invidious
|
|
|
|
# frontend invidious-tor
|
|
# bind /tmp/invidious-tor.sock
|
|
# bind *:8002
|
|
# default_backend invidious-tor
|
|
#
|
|
# frontend invidious-i2p
|
|
# bind /tmp/invidious-i2p.sock
|
|
# bind *:8003
|
|
# default_backend invidious-i2p
|
|
|
|
frontend http3-proxy
|
|
http-request set-var(txn.vipath) path
|
|
# acl vi path_beg /vi/
|
|
bind /tmp/http3-proxy-vpn.sock
|
|
bind *:8004
|
|
#http-response set-header Cache-Control public
|
|
#http-response set-header Expires -1
|
|
#http-response set-header Pragma cache
|
|
# acl youtube_thumbnails path_beg /vi/
|
|
#
|
|
default_backend http3-proxy
|
|
|
|
backend invidious
|
|
balance leastconn
|
|
#http-request cache-use api-cache if { path_beg /api/v1/channels/ }
|
|
#http-response cache-store api-cache
|
|
# acl inv_api var(txn.api) -m beg /api/
|
|
# http-response set-header X-Cache-Status HIT if !{ srv_id -m found } inv_api
|
|
# http-response set-header X-Cache-Status MISS if { srv_id -m found } inv_api
|
|
#
|
|
# 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_ggpht var(txn.ggpht) -m beg /ggpht/
|
|
# 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 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
|
|
# https://www.haproxy.com/documentation/haproxy-configuration-tutorials/service-reliability/retries/
|
|
option redispatch
|
|
|
|
# backend invidious-tor
|
|
# server-template invidious-tor 2 invidious-tor:3000 check resolvers docker init-addr libc,none
|
|
#
|
|
# backend invidious-i2p
|
|
# server-template invidious-i2p 2 invidious-i2p:3000 check resolvers docker init-addr libc,none
|
|
|
|
backend http3-proxy
|
|
# Unix socket for http3-proxy for later
|
|
#server http3-proxy-unix-socket /http3-proxy/http-proxy.sock
|
|
# balance source
|
|
http-request cache-use invidious-thumbnail-cache if { path_beg /vi/ }
|
|
http-response cache-store invidious-thumbnail-cache
|
|
|
|
# https://discourse.haproxy.org/t/http-response-set-header-with-condition-not-working/3108
|
|
acl youtube_thumbnails var(txn.vipath) -m beg /vi/
|
|
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
|
|
server http3-proxy-1-vpn gluetun:8080 check init-addr libc,none
|
|
|