(2.7x, web) backport r13755, r13756, r13766, r13767 for #4873
(2.7x, web) backport r13755, r13756, r13766, r13767 for #4873