add common middleware