Adjust middleware for sec fix

ref: https://bugzilla.mozilla.org/show_bug.cgi?id=941236