https://bz.apache.org/bugzilla/show_bug.cgi?id=62371

            Bug ID: 62371
           Summary: Improve logging in AbstractProcessor.parseHost()
           Product: Tomcat 9
           Version: 9.0.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: alex.cheve...@gmail.com
  Target Milestone: -----

It now sends 400 code without any traces in logs of what is the source of the
problem. In my case it was quite hard to trace the issue. I had:

java.lang.IllegalArgumentException: The character [_] is never valid in a
domain name.
        at
org.apache.tomcat.util.http.parser.HttpParser$DomainParseState.next(HttpParser.java:781)
        at
org.apache.tomcat.util.http.parser.HttpParser.readHostDomainName(HttpParser.java:673)
        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:269)
        at
org.apache.coyote.http11.Http11Processor.prepareRequest(Http11Processor.java:760)
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:383)
        at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
        at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
        at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
        at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:844)


I spend lots of time trying to debug the issue I had.


If you need more info on config - I have:

Apache 2.4 -> ProxyPass ajp -> tomcat (java 10)
           -> ProxyPass websocket (http11) -> tomcat (same)

All this runs as docker containers so in Apache config I connect to tomcat
using name "default_tomcat_1" - given by docker (compose). As a result after
upgrading from tomcat 7.0.56 to 9.0.7 I have all websocket requests just
failing with code 400. After debugging tomcat I understand that websocket
requests go via Http11Processor and fail cause it receives this
"default_tomcat_1" as host name from Apache. At the same time other requests
routed via AJP are working fine cause they've got Apache public IP as "host".

    On apache config:

    ProxyPass /websocket ws://default_tomcat_1:8080/websocket retry=0
    ProxyPassReverse /websocket ws://default_tomcat_1:8080/websocket

    ProxyPass / ajp://default_tomcat_1:8009/ retry=0
    ProxyPassReverse / ajp://default_tomcat_1:8009/

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to