add beforesend for same-server cases again