deploy(nginx): serve the mod jar from nginx with a speed cap (750k per connection) and 2 connections per IP
This commit is contained in:
parent
acb69472c2
commit
4a722259a5
2 changed files with 19 additions and 0 deletions
2
backend/deploy/nginx-lovisual-downloads.conf
Normal file
2
backend/deploy/nginx-lovisual-downloads.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Per-client-IP connection counter for the capped jar download (see the site conf).
|
||||
limit_conn_zone $binary_remote_addr zone=lv_downloads:10m;
|
||||
|
|
@ -18,6 +18,23 @@ server {
|
|||
add_header Cache-Control "public, max-age=60" always;
|
||||
}
|
||||
|
||||
# The mod jar is served by nginx itself (not through the gateway) so the
|
||||
# speed can be capped: ~6 Mbit/s per connection and at most 2 connections
|
||||
# per client IP keep a flood of downloads from saturating the link.
|
||||
location = /api/downloads/lovisual.jar {
|
||||
alias /opt/lovisual/backend/downloads/lovisual.jar;
|
||||
default_type application/java-archive;
|
||||
add_header Content-Disposition 'attachment; filename="lovisual.jar"' always;
|
||||
limit_rate 750k;
|
||||
limit_conn lv_downloads 2;
|
||||
limit_conn_status 429;
|
||||
}
|
||||
|
||||
location = /api/downloads/lovisual.jar.sha256 {
|
||||
alias /opt/lovisual/backend/downloads/lovisual.jar.sha256;
|
||||
default_type text/plain;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8080/;
|
||||
proxy_http_version 1.1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue