Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The character [_] is never valid in a domain name

Tags:

tomcat

I have an exception that underscore cannot be used in the domain names. I want to know whether this exception is version specific or underscore cannot be given in the domain names. If it is version specific, advice me how to resolve it.

java.lang.IllegalArgumentException: The character [_] is never valid in a domain name. at org.apache.tomcat.util.http.parser.HttpParser$DomainParseState.next(HttpParser.java:946) at org.apache.tomcat.util.http.parser.HttpParser.readHostDomainName(HttpParser.java:842) at org.apache.tomcat.util.http.parser.Host.parse(Host.java:66) at org.apache.tomcat.util.http.parser.Host.parse(Host.java:40) at org.apache.coyote.AbstractProcessor.parseHost(AbstractProcessor.java:277) at org.apache.coyote.ajp.AjpProcessor.prepareRequest(AjpProcessor.java:934) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:456) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

like image 813
Abimanyu Avatar asked Nov 27 '18 17:11

Abimanyu


People also ask

What characters are not allowed in a domain name?

Domain names can only use letters, numbers, the fada character (acute accent) and hyphens (“-“). Spaces and other symbols are not permitted for use. Names cannot begin or end with a hyphen and are not case sensitive.

Is a valid character for a domain name?

A domain name consists of minimum two and maximum 63 characters. All letters from a to z, all numbers from 0 to 9 and a hyphen (-) are possible. A domain name mustn't consist of a hyphen (-) on the third and fourth position at the same time.

What makes a domain name invalid?

A malformed or invalid domain is a domain name located in an email address that has an error in spelling or syntax. These types of errors specify domains that do not exist and result in undeliverable emails. Examples of malformed and invalid domains include: [email protected].

How many characters are allowed in a domain name?

Each element of a domain name separated by [.] is called a “label.” The maximum length of each label is 63 characters, and a full domain name can have a maximum of 253 characters. Alphanumeric characters and hyphens can be used in labels, but a domain name must not commence or end with a hyphen.


1 Answers

Tomcat 8.5.x and later implement strict RFC-compliant hostnames as a security precaution. HTTP RFCs require host-header validation and therefore Tomcat performs that validation.

There are a trail of RFCs which require this kind of checking and define what can and cannot be in a hostname.

Your only options are to downgrade Tomcat (not recommended) or fix your hostname to be a valid domain name.

like image 98
Christopher Schultz Avatar answered Nov 16 '22 02:11

Christopher Schultz