handle properly gateway in CasClient