tweaked whoami to handle gateway discovery requests