0
0

Implemented rate-limiting for Quora + Load balanced Breezewiki

This commit is contained in:
Opnxng 2023-12-26 04:08:13 +08:00
parent 9bf1ef764b
commit 1f03e6d7b7
4 changed files with 30 additions and 13 deletions

View File

@ -12,4 +12,4 @@
dest: "{{ docker_dir }}/teddit/about.pug" dest: "{{ docker_dir }}/teddit/about.pug"
owner: 1000 owner: 1000
group: 1000 group: 1000
mode: 0755 mode: 0755

View File

@ -20,10 +20,10 @@ services:
- REVERSO_ENABLE=true - REVERSO_ENABLE=true
ports: ports:
- 8889:5000 - 8889:5000
restart: unless-stopped restart: unless-stopped
networks: networks:
- simplytranslate - simplytranslate
networks: networks:
simplytranslate: simplytranslate:
name: simplytranslate name: simplytranslate

View File

@ -305,7 +305,6 @@
copy_headers Remote-User Remote-Groups Remote-Name Remote-Email copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
#import trusted_proxy_list #import trusted_proxy_list
} }
encode zstd gzip encode zstd gzip
reverse_proxy {{ oracle2_private_ip }}:8893 reverse_proxy {{ oracle2_private_ip }}:8893
header { header {
@ -363,7 +362,17 @@
@z host z.{$HOSTNAME} @z host z.{$HOSTNAME}
handle @z { handle @z {
encode zstd gzip encode zstd gzip
reverse_proxy {{ oracle3_private_ip }}:8897 reverse_proxy {
to {{ oracle1_private_ip }}:8897
to {{ oracle2_private_ip }}:8897
to {{ oracle3_private_ip }}:8897
to {{ oracle4_private_ip }}:8897
lb_policy ip_hash
lb_try_duration 5s
lb_try_interval 1s
fail_duration 30s
max_fails 3
}
header { header {
X-Permitted-Cross-Domain-Policies "none" X-Permitted-Cross-Domain-Policies "none"
X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow"
@ -480,6 +489,8 @@
@q host q.{$HOSTNAME} @q host q.{$HOSTNAME}
handle @q { handle @q {
encode zstd gzip encode zstd gzip
rate_limit {remote.ip} 2r/s 60000 500
rate_limit {remote.ip} 45r/m 300000 500
reverse_proxy { reverse_proxy {
to {{ oracle1_private_ip }}:8904 to {{ oracle1_private_ip }}:8904
to {{ oracle2_private_ip }}:8904 to {{ oracle2_private_ip }}:8904
@ -490,6 +501,7 @@
lb_try_interval 1s lb_try_interval 1s
fail_duration 30s fail_duration 30s
max_fails 3 max_fails 3
header_up X-Real-IP {remote_host}
} }
header { header {
X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow"
@ -645,11 +657,9 @@
X-Frame-Options SAMEORIGIN X-Frame-Options SAMEORIGIN
-Server -Server
} }
log { log {
output discard output discard
} }
handle { handle {
abort abort
} }
@ -660,15 +670,12 @@
# Imgin redirect to handle i.imgur.com # Imgin redirect to handle i.imgur.com
i.r.{$HOSTNAME} { i.r.{$HOSTNAME} {
handle { handle {
redir https://r.opnxng.com{uri} redir https://r.opnxng.com{uri}
} }
log { log {
output discard output discard
} }
handle { handle {
abort abort
} }

View File

@ -1,6 +1,10 @@
config: config:
vultr: oracle4:
- teddit - caddy
compose:
oracle4:
- caddy
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
@ -18,6 +22,7 @@ deployed-compose:
- send - send
- privatebin - privatebin
#################### ####################
- breezewiki
- voyager - voyager
- mlmym - mlmym
- photon - photon
@ -40,6 +45,7 @@ deployed-compose:
- firefox - firefox
- wolfree - wolfree
#################### ####################
- breezewiki
- voyager - voyager
- mlmym - mlmym
- photon - photon
@ -59,12 +65,12 @@ deployed-compose:
- socks5 - socks5
- priviblur - priviblur
oracle3: oracle3:
- breezewiki
- etherpad - etherpad
- gitea - gitea
- runner - runner
- ntfy - ntfy
#################### ####################
- breezewiki
- voyager - voyager
- mlmym - mlmym
- photon - photon
@ -90,6 +96,7 @@ deployed-compose:
- authelia - authelia
- geoipupdate - geoipupdate
#################### ####################
- breezewiki
- voyager - voyager
- mlmym - mlmym
- photon - photon
@ -119,11 +126,13 @@ deployed-config:
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- priviblur - priviblur
- breezewiki
oracle2: oracle2:
- firefox - firefox
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- priviblur - priviblur
- breezewiki
oracle3: oracle3:
- ntfy - ntfy
- gitea - gitea
@ -141,3 +150,4 @@ deployed-config:
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- priviblur - priviblur
- breezewiki