varnish / libvmod-rtstatus

Varnish realtime status page.
Other
37 stars 16 forks source link

application/json should be delivered for the .json not text/plain #28

Closed hugocruz closed 7 years ago

hugocruz commented 7 years ago

In the readme

vcl_synth for the rtstatus.json endpoint should be :

set resp.http.Content-Type = "application/json"

Full VCL:

sub vcl_synth {
        if (resp.status == 700){
            set resp.status = 200;
            set resp.http.Content-Type = "application/json";
            synthetic(rtstatus.rtstatus(5));
            return (deliver);
        }
        if (resp.status == 800) {
            set resp.status = 200;
            set resp.http.Content-Type = "text/html; charset=utf-8";
            synthetic(rtstatus.html());
            return (deliver);
            }
    }

I'll create a pull request.