add middleware plugin support