server {
  listen                      80;
  server_name                 _;

  gzip_min_length     1000;
  gzip_buffers        4 8k;
  gzip_http_version   1.0;
  gzip_disable        "msie6";
  gzip_types          text/plain text/css application/json;
  gzip_vary           on;

  index index.html;

  location ~ ^/wapt.* {
    proxy_set_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
    proxy_set_header Pragma "no-cache";
    proxy_set_header Expires "Sun, 19 Nov 1978 05:00:00 GMT";
    root "/var/www/html";
  }

  location / {
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    client_max_body_size 4096m;
    client_body_timeout 1800;

    location /add_host_kerberos {
      return 403;
    }

    location  ~ ^/(api/v3/upload_packages|api/v3/upload_hosts/|upload_waptsetup)  {
      proxy_pass http://127.0.0.1:8080;
      client_max_body_size 4096m;
      client_body_timeout 1800;
    }

    location /wapt-host/Packages {
      return 403;
    }

    location / {
      proxy_pass http://127.0.0.1:8080;
    }

    location /socket.io {
      proxy_http_version 1.1;
      proxy_buffering off;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      proxy_pass http://127.0.0.1:8080/socket.io;
    }
  }
}
