More flexible staticMiddleware