As with any other website, the Host header tells you what domain was requested. We already do this in the certified assets crate/canister:
Host