Use referer header if it exists.