client: Detect cross-origin requests

Also be aware that different ports on the same host are considered cross-origin.