We don't want a full (absolute) URL put into config file, because we install the webapp on all different servers and will have to keep changing the config each time.
If that's the case, you should override loginRequired() as you described:
public function loginRequired()
{
if(is_array($this->loginUrl))
$this->loginUrl=Yii::app->createAbsoluteUrl($route,array_splice($url,1),'http');
parent::loginRequired();
}