server {
    listen 8080;
    server_name localhost;
    root /tmp/site;

    resolver kube-dns.kube-system.svc.cluster.local valid=10s;

    gzip on;
    gzip_comp_level 9;
    gzip_types
    text/html
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/json
    application/xml
    application/rss+xml
    image/svg+xml;

    location ^~ /storage {
        proxy_pass http://http.sftpgo.svc.cluster.local:8080/storage;
        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-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
    }

    location / {
        index index.html index.htm;
    }

    location ~* ^/([^/]+) {
        index index.html index.htm;
        error_page 404 = @error;
    }

    error_page 404 /404.html;
    location @error {
        try_files /$1/404.html /404.html =404;
    }
}
