Add middleware support.