worker_processes 1;

events {
  worker_connections 1024;
}

http{
  sendfile on;

  upstream docker-backend {
    server backend:4000;
  }

  upstream docker-frontend {
    server frontend:3000;
  }

  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-Host $server_name;

  server {
    listen 8820;

    location / {
      proxy_pass      http://frontend:3000;
      proxy_redirect  off;
    }

    location /graphql/ {
      proxy_pass      http://backend:4000/graphql;
      proxy_redirect  off;
    }
  }
}