[BUG] error logic to rewrite http/cookie
[BUG] fixed multiple response.WriteHeader calls error