upstream frontend {
    server frontend:3000;
}

upstream backend {
    server backend:8000;
}

server {
  listen 80;
  location / {
    proxy_pass http://frontend;
  }

  location /api/v1/ {
    proxy_pass http://backend;
  }

  # https://stackoverflow.com/questions/70585472/websocketclient-js16-websocket-connection-to-ws-localhost3000-ws-failed-r
  location /ws {
    proxy_pass http://frontend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}
