location ^~ /.well-known {
        location = /.well-known/carddav { return 301 /remote.php/dav/; }
        location = /.well-known/caldav  { return 301 /remote.php/dav/; }

        return 301 /index.php$request_uri;
    }


    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }

    location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
        try_files $uri /index.php$request_uri;
        # 182 days, 14 hours, 54 minutes, 23 seconds. I have no clue why
        # this exact value, but i copied it from the example config.
        add_header Cache-Control "public, max-age=15778463, $asset_immutable";

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

    location ~ \.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;
    }

    location /remote {
        return 301 /remote.php$request_uri;
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }

    # cursed shit, use like this to have the 'map' feature outside the regular nginx config
}

map $arg_v $asset_immutable {
    "" "";
    default "immutable";