This is necessary for the GET /docs endpoint, which can be used to send urls as part of query parameters. If these are not encoded before redirecting, they can become corrupted.