How do I get the current Salesforce domain?

Is there a particular reason you need to have an absolute URL? Usually this is only necessary if you are in a Site / Community environment, in which case you can use {{$Site.CurrentSiteUrl}}, otherwise you should just use relative URL’s.