Introduce new `base_url` function for relative canonicals. 

This fixes #1773 while setting the scheme correctly.