server {
  listen 80 default_server;
  listen [::]:80 default_server;

  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;

  access_log  off;

  # allow port numbers in 301 redirects
  absolute_redirect off;

  client_max_body_size 50M;
  add_header 'Access-Control-Expose-Headers' 'Content-Disposition';

  root /usr/share/eulink/gui/;

  location / {
    return 301 /gui;
  }

  location /gui {
    alias /usr/share/eulink/gui/;
    try_files $uri$args $uri$args/ $uri $uri/ @index;
   }

  location @index {
    add_header Cache-Control no-cache;
    expires 0;
    try_files /index.html =404;
  }

  location /api {
    proxy_set_header        Upgrade $http_upgrade;
    proxy_set_header        Connection "Upgrade";
    proxy_pass http://localhost:9999/api;
  }

  location /static/icons {
    sendfile on;
    alias /var/www/static/icons;
  }
}
