skip db write on ajax request in middlaware