Worker URL obj parses double backslash diff from Chrome

(new URL(“”)).pathname

In a CF Worker I get


In Chrome 83 console I get


Notice Chrome passes through the //, CF Worker V8 drops the // to a single / changing the path given to the actual API origin end point. Huh?Both the browser and a CFW are V8 JS Engine right?

I do see the warning at but there needs to be documentation how CFW URL objects are different from W3C URL objects. Its a landmine if a CFW URL object retrieves a different file on origin than in a fake CFW/mockup on a devs machine with Node JS or Chrome console under a certain input.

Just add this to any CFW and look at the header

headers.set(“X-pathtest”,(new URL(“”)).pathname)

only 1 / in pathname

+1, this seems like a legit bug. As a reduced example: parses incorrectly in a worker.

I believe that may be related to this:

Current fix/workaround for this would be to add a URL library/polyfill to your worker that parses your urls instead.