How can I use getLocalPort to get backend port instead of the front httpd port?

Solution Unverified - Updated -

Issue

  • Having a test on EAP to make sure which port does the http request come from, http connector on 8080, or ajp on 8009. And I take mod_jk/mod_cluster on apache httpd as frontend. The httpd listen on 80.
  • In my servlet I try to use getServerPort() or getRemotePort(), but all the result is 80. The getLocalPort() is 0 or -1. Is there someway to get the correct port number?

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 4.3
    • 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.