Skip to content

Commit

Permalink
Fix the directive location to be nested so that it inherits parent di…
Browse files Browse the repository at this point in the history
…rective configuration

Bug: T370901
  • Loading branch information
katydidnot committed Dec 6, 2024
1 parent 0011846 commit 04b22c2
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,8 @@ server {
return 403;
}
location /admin/links/ {
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
# https://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout
send_timeout 120s;
keepalive_timeout 120s;
try_files $uri @django-admin-slow
}

# checks for static file, if not found proxy to app
try_files $uri @django;
}
Expand All @@ -104,4 +97,28 @@ server {
proxy_redirect off;
proxy_pass http://django_server;
}
location @django-admin-slow {
# https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout
proxy_connect_timeout 120s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
# https://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout
send_timeout 120s;
keepalive_timeout 120s;
# Cache
proxy_cache_valid 200 301 302 401 403 404 1d;
proxy_cache_bypass $http_pragma $no_cache_method $no_cache_control $no_cache_session;
proxy_cache_revalidate on;
proxy_cache cache;
add_header X-Cache-Status $upstream_cache_status;
# Rate limit
limit_req zone=bots burst=2 nodelay;
limit_req zone=one burst=1000 nodelay;
limit_req_status 429;
# Proxy
proxy_set_header X-Forwarded-Proto $web_proxy_scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://django_server;
}
}

0 comments on commit 04b22c2

Please sign in to comment.