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,

        I believe you have already fixed this - can you confirm?

        Show
        Greg Wilkins added a comment - Bong, I believe you have already fixed this - can you confirm?
        Greg Wilkins made changes -
        Field Original Value New Value
        Assignee Leopoldo Agdeppa III [ lagdeppa ]
        Hide
        Leopoldo Agdeppa III added a comment -

        yes, this is already fixed since jetty-6.1.0 - 5 Jan 2007

        Show
        Leopoldo Agdeppa III added a comment - yes, this is already fixed since jetty-6.1.0 - 5 Jan 2007
        Hide
        Leopoldo Agdeppa III added a comment -

        I think this is not a bug on our side, since this has already been forwarded twice from firewall to apache then apache to jetty,
        either the two has changed the http headers the firewall or apache, jetty only processes what It receives

        Show
        Leopoldo Agdeppa III added a comment - I think this is not a bug on our side, since this has already been forwarded twice from firewall to apache then apache to jetty, either the two has changed the http headers the firewall or apache, jetty only processes what It receives
        Hide
        isenberg added a comment -

        The version is jetty-6.1.0 - 9 Jan 2007 according to VERSION.TXT.

        When replacing Jetty by Tomcat 5.5 or 6.0 it works like expected.

        Show
        isenberg added a comment - The version is jetty-6.1.0 - 9 Jan 2007 according to VERSION.TXT. When replacing Jetty by Tomcat 5.5 or 6.0 it works like expected.
        Hide
        Leopoldo Agdeppa III added a comment -

        ill check on this right now

        Show
        Leopoldo Agdeppa III added a comment - ill check on this right now
        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
        Leopoldo Agdeppa III made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: