Fixed #19866 -- handler returns 400 for disallowed hosts

Thanks to tiwoc for the suggestion