Quite why this isn’t how WordPress works by default, I’ll probably never know.
$domain = 'http' . (false ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];
define( 'WP_SITEURL', $domain );
define( 'WP_HOME', $domain );
If anything, this snippet is for my own reference.
Prevents redirects on development / staging sites without changing the wp-config.php