Trim / from path before it goes into parse_url

From #5106.

Couldn't test this locally, missing environment setup to do so.