Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1569

HttpServletRequest getLocalName() returns IP instead of hostname

XMLWordPrintable

    • Workaround Exists
    • Hide

      Use io.undertow.server.handlers.LocalNameResolvingHandler ('resolve-local-name' in expression-filter).
      However, it does have a performance penalty as it does a reverse DNS lookup.

      #CLI command

      /subsystem=undertow/configuration=filter/expression-filter=resolve-local-name-filter:add(expression=resolve-local-name)
      /subsystem=undertow/server=default-server/host=default-host/filter-ref=resolve-local-name-filter:add()
      
      Show
      Use io.undertow.server.handlers.LocalNameResolvingHandler ('resolve-local-name' in expression-filter). However, it does have a performance penalty as it does a reverse DNS lookup. #CLI command /subsystem=undertow/configuration=filter/expression-filter=resolve-local-name-filter:add(expression=resolve-local-name) /subsystem=undertow/server= default -server/host= default -host/filter-ref=resolve-local-name-filter:add()

      HttpServletRequest getLocalName() returns IP instead of hostname

      If I deploy the below sample code on EAP 7.x

      protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
                System.out.println(request.getLocalName());
                System.out.println(request.getClass());
      }
      

      Output on EAP 7

      17:10:06,950 INFO  [stdout] (default task-1) 10.65.193.93
      17:10:06,950 INFO  [stdout] (default task-1) class io.undertow.servlet.spec.HttpServletRequestImpl
      

      IP address instead of hostname

              rhn-support-tmiyargi Teresa Miyar Gil (Inactive)
              rhn-support-tmiyargi Teresa Miyar Gil (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: