Improve middleware with a better static file filter.