Error handling in Varnish?

Hi.
Saw on some sites (like CloudFlare) error handler (404, 503, etc) is have Varnish.
Here's my Varnish config:
spoiler
vcl 4.0;
backend default { 
 .host = "127.0.0.1";
 .port = "8080";
}

sub vcl_synth {
 set resp.http.Content-Type = "text/html; charset=utf-8";
 set resp.http.Retry-After = "5";
 synthetic( {"<!DOCTYPE html>
<html>
the <head>
 <title>"} + resp.status + "" + resp.reason + {"</title>
</head>
the <body>
 <h1>Error "} + resp.status + "" + resp.reason + {"</h1>
 <p>"} + resp.reason + {"</p>
 the <h3>Guru Meditation:</h3>
 <p>XID: "} + req.xid + {"</p>
<hr>
 <p>Varnish cache server</p>
</body>
</html>
 "} );
 return (deliver);
}


Nginx configuration:
spoiler
server {
 server_name cdn.site.me;
 listen 443 ssl http2;

 location = / {
 proxy_http_version 1.1;
 proxy_pass http://127.0.0.1:80;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto https;
 proxy_set_header X-Forwarded-Port 443;
 proxy_set_header Host $Host;
}
}
 server {
 server_name cdn.site.me;
 listen 8080;

 root /var/www/html;
 index index.lua;

 location = / {
 content_by_lua_file /var/www/html/index.luac;
 lua_code_cache on;
}
 }


And, in fact, when I go, for example, on a cdn.site.me/324, it gives an error 404 with nginx myself, and would like to gave an error Varnish.
March 23rd 20 at 19:42
0 answer

Find more questions by tags VarnishNginx