Jetty
  1. Jetty
  2. JETTY-291

HttpServletRequest.getServerPort returns local port instead of port in http request using Ajp13SocketConnector

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Apache 2.2.3, proxy_ajp_module, JDK 1.5.0_11, Linux, Java Servlet Spec 2.4
    • Number of attachments :
      0

      Description

      getServerPort() returns the local HTTP-port of Apache and not the port given by the HTTP-Client. That problem occurs when Apache is used with port-forwarding behind a firewall with different source and destination ports.

      1. HTTP-Client sends: GET http://web:8000/index.html
      2. Firewall forwards web:8000 to localserver:7000
      3. Apache on localserver:7000 forwards request via AJP13 to Jetty 6.1.0
      4. Jetty receives GET http://web:8000/index.html getServerName() == web (correct), getServerPort() == 7000 (wrong)

      Java Servlet Spec 2.4 introduces getLocalPort() which indeed should return 7000 in this case, but getServerPort() should return 8000.

        Activity

        Hide
        Greg Wilkins added a comment -

        bong,

        please mark this issue as resolved (if you think it is).

        Show
        Greg Wilkins added a comment - bong, please mark this issue as resolved (if you think it is).
        Hide
        isenberg added a comment -

        Let me know if I should test any new version.

        Show
        isenberg added a comment - Let me know if I should test any new version.
        Hide
        Leopoldo Agdeppa III added a comment -

        Cant figure out if this one is a bug. just followed the packets sent by the proxy and jk

        Show
        Leopoldo Agdeppa III added a comment - Cant figure out if this one is a bug. just followed the packets sent by the proxy and jk
        Hide
        Leopoldo Agdeppa III added a comment -

        i dont think this is a bug, since Server Port and Server Address is given by ajp packets

        Show
        Leopoldo Agdeppa III added a comment - i dont think this is a bug, since Server Port and Server Address is given by ajp packets
        Hide
        Leopoldo Agdeppa III added a comment -

        not a bug, no problem found on testing

        Show
        Leopoldo Agdeppa III added a comment - not a bug, no problem found on testing

          People

          • Assignee:
            Leopoldo Agdeppa III
            Reporter:
            isenberg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: