
server {
    # We use the proxy_read_timeout directive here (instead of proxy_send_timeout) as it sets the timeout for reading a response from the proxied server vs. setting a timeout for sending a request to the proxied server.
    listen 8080;

    # Liveness
    location / {
        add_header Content-Type text/plain;
        return 200 "";
    }

    # Readiness
    location ~ ^/v1/models/model$ {
        proxy_redirect off;
        proxy_read_timeout 300s;

        rewrite ^/v1/models/model$ /health break;

        proxy_pass http://127.0.0.1:8081;
    }

    # Predict
    location ~ ^/v1/models/model:predict$ {
        proxy_redirect off;
        proxy_read_timeout 300s;

        rewrite ^/v1/models/model:predict$ /{{endpoint}} break;

        proxy_pass http://127.0.0.1:8081;
    }

}
