remove caching and static __dirname from middleware