public static String from(RoutingTable routingTable, RoutingStatus routingStatus) {
        StringBuilder sb = new StringBuilder();

        // Map SNI header to upstream
        sb.append("map $ssl_preread_server_name $name {\n");
        routingTable.asMap().forEach((endpoint, target) -> {
            sb.append("   ").append(endpoint.dnsName()).append(" ").append(target.id()).append(";\n");
        });

        // Forward requests without SNI header directly to Nginx (e.g. VIP health checks)
        sb.append("   '' default;\n");
        sb.append("}\n\n");

        // Render routing table targets as upstreams
        renderUpstreamsTo(sb, routingTable, routingStatus);

        // Configure the default upstream, which targets Nginx itself
        sb.append("upstream default {\n");
        sb.append("   server localhost:4445;\n");
        sb.append("   ").append(checkDirective(4080)).append("\n");
        sb.append("   ").append(checkHttpSendDirective("localhost")).append("\n");
        sb.append("}\n\n");

        // Listener port
        sb.append("server {\n");
        sb.append("   listen 443 reuseport;\n");
        sb.append("   listen [::]:443 reuseport;\n");
        sb.append("   proxy_pass $name;\n");
        sb.append("   ssl_preread on;\n");
        sb.append("   proxy_protocol on;\n");
        sb.append("}\n");

        return sb.toString();
    }
Converts a {@link RoutingTable} to Nginx's own config format.

@author Martin Polden
routing-generator/src/main/java/com/yahoo/vespa/hosted/routing/nginx/NginxConfig.java