Use site.domain instead of site|safe for generating API root URL