diff --git a/Resources/nginx/nginx.conf b/Resources/nginx/nginx.conf index 0aee73f6..0e1a4cbb 100644 --- a/Resources/nginx/nginx.conf +++ b/Resources/nginx/nginx.conf @@ -37,10 +37,6 @@ http { resolver 127.0.0.11 valid=30s; - upstream pokeapi_upstream { - server app:80 fail_timeout=0; - } - upstream graphql_upstream { server graphql-engine:8080 fail_timeout=0; } @@ -94,11 +90,11 @@ http { location /graphql/v1beta { proxy_read_timeout 70s; - # proxy_cache small; - # proxy_cache_valid 200 10d; - # proxy_cache_valid any 0; - # proxy_cache_methods POST; - # proxy_cache_key "$request_method$request_uri$request_body"; + proxy_cache small; + proxy_cache_valid 200 10d; + proxy_cache_valid any 0; + proxy_cache_methods POST; + proxy_cache_key "$request_method$request_uri$request_body"; limit_req zone=graphqlDefaultLimit burst=100 nodelay; limit_req_status 429; expires 30m; # client-side caching, one minute for each API resource @@ -124,7 +120,8 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; - proxy_pass http://pokeapi_upstream; + set $upstream app; + proxy_pass http://$upstream:80; } location / { diff --git a/docker-compose.yml b/docker-compose.yml index 56837d25..0629182d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: volumes: - ./Resources/nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./Resources/nginx/ssl:/ssl:ro - + - graphql_cache:/tmp/cache graphql-engine: image: hasura/graphql-engine:v2.0.8 ports: @@ -65,3 +65,4 @@ services: volumes: pg_data: redis_data: + graphql_cache: