API Gateway: Route via HTTP(S) assertion fails with error "Contains non-LDH ASCII characters".

book

Article ID: 143243

calendar_today

Updated On:

Products

CA API Gateway API SECURITY CA API Gateway Precision API Monitoring Module for API Gateway (Layer 7) CA API Gateway Enterprise Service Manager (Layer 7) STARTER PACK-7 CA Microgateway

Issue/Introduction

The Route via HTTP(S) assertion fails/errors with a message "Contains non-LDH ASCII characters".

If a hostname (note: a hostname, not a domain name) contains non-LDH ASCII characters, then the route will fail as it breaks a number of RFCs including RFC1123 and RFC5890 which states that all hostnames must contain letters, digits, and hyphens only. Anything else is considered to be "illegal syntax". This is an industry standard since it is in an RFC that hostnames must only include letters, digits, and hyphens.

Note: "LDH" is parlance used in the RFCs and stands for "Letters, Digits, Hyphens".

Cause

The hostname used in the routing assertion contains non-LDH ASCII characters, as the error implies. This can include characters such as an underscore in the hostname, for example. Essentially it includes any character that isn't a letter, digit, or hyphen in the hostname.

Environment

This impacts all API Gateway versions. It is not a Gateway-specific error but a common one used in Java and other platforms. 

Resolution

Hostnames should be modified to follow the RFCs which state that only LDH characters be used. There is no workaround available on the Gateway to accommodate non-RFC compliant use-cases. The only possible workaround (not guaranteed to work) must be set at the network DNS level which is to create a CNAME or another A record that the backend host will accept and can then be used in the Gateway Route via HTTP(S) assertion in place of the hostname containing non-LDH characters.

Additional Information

The following external references may be helpful: