Added before and after callback support to the middleware. Filter out bad headers from prerender service request that will leave requests hanging.