Skip to content

Commit

Permalink
Improve nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusklocke committed Jan 11, 2025
1 parent 61a86d8 commit 3e9385f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docker/nginx/dev-roadrunner-ssl.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
limit_req_zone $binary_remote_addr zone=main:10m rate=5r/s;
limit_req zone=main burst=200 nodelay;
limit_req_status 429;

upstream php {
server php:8080 max_fails=0 fail_timeout=30s;
}
Expand Down Expand Up @@ -34,13 +38,25 @@ server {

client_max_body_size 64M;

location /429.json {
internal;
return 429 '{"errors":[{"code":"ERR-RATE-LIMIT","message":"Exceeded rate limit. Please slow down your requests."}]}';
}

location /502.json {
internal;
return 502 '{"errors":[{"code":"ERR-INTERNAL","message":"Bad gateway"}]}';
}

location /api {
proxy_pass http://php;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
error_page 429 /429.json;
error_page 502 /502.json;
}

location /logos {
Expand Down

0 comments on commit 3e9385f

Please sign in to comment.