A rifi middleware