The issue arises from improper input validation due to incorrect parsing. This allows the hostname to be spoofed, as seen in the comparison between http://localhost and http://localhost, which are considered the same URL. However, the hostname is not parsed correctly as localhost, and the backslash is reflected as is.