resolver 127.0.0.11;

upstream backend_app {
    zone backend_app 64k;
    server app:8080 resolve;
}

server {
  listen 80 default_server;
  gzip on;
  gzip_types text/plain application/xml text/css application/javascript;
  gzip_min_length 1000;
  client_max_body_size 0;

  location / {
      root /usr/share/nginx/html;
      include /etc/nginx/mime.types;
      try_files $uri /index.html;
  }

  location /api {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 1m;
    proxy_connect_timeout 1m;
    proxy_pass http://backend_app/api;
  }

}