This works fine in the browser but fails in node
new URL('http://xn--www-4m0aa.hergivenhair.com/?y=MAKEBA112')
TypeError [ERR_INVALID_URL]: Invalid URL: http://xn--www-4m0aa.hergivenhair.com/?y=MAKEBA112
at onParseError (internal/url.js:237:17)
at parse (internal/url.js:246:3)
at new URL (internal/url.js:321:5)
Browsers appear to be giving this a bit more leniency but the URL does not appear to be valid punycode.
@TimothyGu ... thoughts?
The whatwg-url module also throws with this URL.
@jimmywarting what is the original utf-8 name of the domain?
it seems this URL isn't correct one.

@jimmywarting what is the original utf-8 name of the domain?
Don't know... there was a bit.ly url that redirects
https://bitly.com/hergivenhairKeeb+
I was looking into this PR https://github.com/bitinn/node-fetch/pull/532
I thought that instead of just throwing a error, i thought: how can we handle it and potentially fix it?
xn--www-4m0aa decoded is \u200B\u200Bwww. U+200B is the zero-width space.
From a security perspective, I'd say it's right it gets rejected, otherwise it's easy to create URLs that look identical visually.
So everyone here seems to be saying that it's a invalid punycode url. So is Node doing this correctly and the browser dose not?
Correct. The browsers seem to be falling back to a lenient parse mode that does not actually try to interpret the invalid punycode.
Agreed with all of the above. Note, the latest whatwg-url package also throws when this URL is parsed.
Closing this as there is consensus that this is not a bug in node.js
Most helpful comment
xn--www-4m0aadecoded is\u200B\u200Bwww. U+200B is the zero-width space.From a security perspective, I'd say it's right it gets rejected, otherwise it's easy to create URLs that look identical visually.