add middleware v3.0