before rewrite server and clients