Modifying middleware to fix safari caching issues