Skip to content

Commit 02fe04c

Browse files
Mostowiec DominikMostowiec Dominik
authored andcommitted
add a short-lived cache for all requests in case of network problems in connection to AWS
1 parent 635c408 commit 02fe04c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

files/nginx.conf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ http {
3636
chunked_transfer_encoding on;
3737

3838
# increases timeouts to avoid HTTP 504
39-
proxy_connect_timeout 300s;
39+
proxy_connect_timeout 3s;
4040
proxy_read_timeout 300s;
4141
proxy_send_timeout 300s;
4242
send_timeout 300s;
4343

4444
# disable proxy request buffering
4545
proxy_request_buffering off;
46+
proxy_cache cache;
47+
proxy_cache_key $scheme$uri$args$request_method;
48+
proxy_cache_valid 200 1s;
49+
proxy_cache_use_stale error timeout invalid_header updating
50+
http_500 http_502 http_503 http_504;
51+
proxy_cache_lock on;
4652

4753
add_header "Access-Control-Allow-Origin" "*";
4854

@@ -88,7 +94,7 @@ http {
8894
set $saved_redirect_location '$upstream_http_location';
8995
proxy_pass $saved_redirect_location;
9096
proxy_cache cache;
91-
proxy_cache_key $scheme$proxy_host$uri$request_method;
97+
proxy_cache_key $scheme$uri$args$request_method;
9298
proxy_cache_valid 200 1y;
9399
proxy_cache_use_stale error timeout invalid_header updating
94100
http_500 http_502 http_503 http_504;

0 commit comments

Comments
 (0)