Rewriting resource fetching