Porting PR #2843 to 2.5.x
Merge remote-tracking branch 'upstream/2.5.x' into 2.5.x-defrules