How do I disable 'Transfer-Encoding: chunked' encoding in Varnish?

后端 未结 3 2053
误落风尘
误落风尘 2021-02-07 22:29

Using Varnish 4, I have a set of backends that\'re responding with a valid Content-Length header and no Transfer-Encoding header.

On the first

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 22:49

    For the time being, do_stream = false will do what you want.

    Avoiding chunked encoding for the case where the backend sends unchunked is a possible future improvement to Varnish.

    Example:

    sub vcl_backend_response {
            if(beresp.http.Content-Type ~ "video") {
                    set beresp.do_stream = false;
                    set beresp.do_gzip = false;
                    //set resp.http.Content-Length = beresp.http.Content-Length;
            }
            if(beresp.http.Edge-Control == "no-store") {
                    set beresp.uncacheable = true;
                    set beresp.ttl = 60s;
                    set beresp.http.Smug-Cacheable = "No";
                    return(deliver);
            }
    }
    

提交回复
热议问题