콘텐츠로 이동
Aa

Maintenance

이 콘텐츠는 아직 번역되지 않았습니다.

Return an unavailable-service message without forwarding the request to the application. Choose a direct response when you deliberately want matching requests to stop at the edge; this example selects /maintenance and returns 503.

Visitor message: Scheduled maintenance

The load balancer’s direct_response_route selects /maintenance; route_direct_response sets the status and encoded body. The matching more_option.custom_errors["503"] mapping supplies the same body for this direct error status. Both fragments belong to the same load balancer. In the qualified example, the mapping is required for the intended page to appear.

Maintenance configuration source

{
"spec": {
"routes": [
{
"direct_response_route": {
"path": {
"path": "/maintenance"
},
"route_direct_response": {
"response_code": 503,
"response_body_encoded": "string:///PCFkb2N0eXBlIGh0bWw+PGh0bWwgbGFuZz0iZW4iPjxoZWFkPjxtZXRhIGNoYXJzZXQ9InV0Zi04Ij48bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoIj48dGl0bGU+U2NoZWR1bGVkIG1haW50ZW5hbmNlPC90aXRsZT48L2hlYWQ+PGJvZHk+PG1haW4+PGgxPlNjaGVkdWxlZCBtYWludGVuYW5jZTwvaDE+PHA+RjUgY3VzdG9tIHJlc3BvbnNlcyBzaG93Y2FzZS48L3A+PC9tYWluPjwvYm9keT48L2h0bWw+"
},
"http_method": "ANY"
}
}
]
}
}
{
"spec": {
"more_option": {
"custom_errors": {
"503": "<ENCODED_RESPONSE_BODY>"
}
}
}
}

Decoded preview (escaped):

<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Scheduled maintenance</title></head><body><main><h1>Scheduled maintenance</h1><p>F5 custom responses showcase.</p></main></body></html>

The mapping can also change other eligible 503 responses on this host. It does not establish replacement of application-generated errors; see Error responses for that distinction.

Verified live example: View the maintenance page.

Expected result: The selected path returns 503 with “Scheduled maintenance”; / returns the normal application response. Compare the body as well as the status. Only matching routes stop forwarding requests.