Seeing "URL rejected: Malformed input to a URL function" error when testing URLs using curl
search cancel

Seeing "URL rejected: Malformed input to a URL function" error when testing URLs using curl

book

Article ID: 371676

calendar_today

Updated On:

Products

VMware Avi Load Balancer

Issue/Introduction

When using curl to test connectivity to web and ldap servers, you may get the following error message when using the curl command:

curl: (3) URL rejected: Malformed input to a URL function

Cause

This may be due to URL checking in the newer versions of the curl library. Previous versions of curl allowed some special characters such as spaces in the URL, but newer versions of the curl library in ALB releases > 30.1.1 will return an error.

Resolution

You will need to use "percent encoding" in the URL to encode the special character.
https://www.w3schools.com/tags/ref_urlencode.ASP

For example, when testing an LDAP URL using curl, the below command will work in previous versions of curl:

curl -v "ldap://[ip address]:389/OU=Active Service Accounts,OU=Service Accounts,OU=Corporate Office,DC=mycompany,DC=com" -u "CN=ldapsmon,OU=Active Service Accounts,OU=Service Accounts,OU=Corporate Office,DC=mycompany,DC=com":"PASSWORD"

However this will fail in the newer versions with the error "URL rejected: Malformed input to a URL function". You will need to replace the space with "%20" like below:

curl -v ldap://[ip address]:389/OU=Active%20Service%20Accounts,OU=Service%20Accounts,OU=Corporate%20Office,DC=mycompany,DC=com -u "CN=ldapsmon,OU=Active Service Accounts,OU=Service Accounts,OU=Corporate Office,DC=mycompany,DC=com":"PASSWORD"