2
광택 4의 '503 백엔드 가져 오기 실패'를 사용자 정의하려면 어떻게해야합니까?503 오류를 사용자 정의하는 방법 - 광택 4
sub vcl_synth {
if (resp.status == 750) {
set resp.http.location = "http://mobile.cronica.com.ar/";
set resp.status = 302;
set resp.http.Action = "Redirect";
return(deliver);
}
if (resp.status == 751) {
set resp.status = 301;
set resp.http.location = "http://www." + req.http.host + req.url;
set resp.http.Action = "Redirect";
return(deliver);
}
else {
synthetic({"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>"} + resp.status + " " + resp.reason + {"</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
</head>
<body style="background-color:#444; font-family: 'Oswald', sans-serif;">
<h1 style="color:#DD8363;">Error "} + resp.status + " " + {"</h1>
<p style="color:#5F88C4; ">"} + resp.reason + {"</p>
<h3 style="color:white;">CEPI Says</h3>
<p style="color:#bdb76b;">XID: "} + req.xid + {"</p>
<p style="color:#bdb76b;">Edge-Server: "} + server.hostname + {"</p>
<hr>
<p style="color:#65b042;">2.0</p>
</body>
</html>
"});
return(deliver);
}
}
을하지만 503 오류가를 피하기 위해 보인다 그들은 신디사이저 단계를 통해 얻을 때
나는 다른 오류를 정의하고있다.
좋아요! 그것은 해결책입니다. 질문이 있으시면이 서브 루틴의 오류 메시지 (vcl_backend_error)에 server.hostname (에지 서버 호스트 이름)을 넣는 방법이 있습니까? – nlopez
당신이 원하는 호스트 이름에 대해 잘 모르겠다.'server.hostname'은'vcl_synth' (클라이언트 요청을받은 서버)에서 사용할 수 있으며'beresp.backend.name','beresp.backend.ip'는 다음과 같습니다. 'vcl_backend_error' (에러를 생성 한 백엔드 또는 사용 가능한 백엔드가없는 경우 "(null)")에서 사용할 수 있습니다. 내 테스트에서'new vdir = directors.round_robin(); 그리고 살아있는 백엔드는 없다'beresp.backend.name + beresp.backend.ip' →'vdir (null)' –