Skip to content

Instantly share code, notes, and snippets.

@hatzopoulos
Last active October 29, 2021 00:39
Show Gist options
  • Save hatzopoulos/38059f2300a8fcb95794 to your computer and use it in GitHub Desktop.
Save hatzopoulos/38059f2300a8fcb95794 to your computer and use it in GitHub Desktop.
PHP Example, 503 Header + Retry After
<?php
ob_start();
// 503 Header
header('HTTP/1.1 503 Service Temporarily Unavailable', true, 503);
// Retry-After header. Two examples of its use are:
// 1. Retry-After: 120
header('Retry-After: '.(1 * 60 * 60));
// 2. Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
header('Retry-After: '.gmdate('D, d M Y H:i:s', strtotime('+1 hour')).' GMT');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment