    # WebSocket stuff
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''	close;
    }

    # Still need an nginx proxy to:
    #  - rewrite Remote-User authelia header to REMOTE_USER
    #    See https://github.com/containous/traefik/issues/6047

    server {
	    listen 80;
        server_name ~.;

        location / {
            proxy_set_header REMOTE_USER $http_remote_user@bipaa;
            proxy_connect_timeout       6000;
            proxy_send_timeout          6000;
            proxy_read_timeout          6000;
            send_timeout                6000;

            client_max_body_size 50g;

            # WebSocket stuff
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;

            proxy_redirect   http://apollo.apollo:8080/      http://$http_host/;
            proxy_pass       http://apollo.apollo:8080/;

            proxy_cookie_path ~*^/([^/]*) /apollo/$1;
        }
    }
