Bug 995411 - Virtual Server cannot take "localhost" as alias more then once
Virtual Server cannot take "localhost" as alias more then once
Status: CLOSED NOTABUG
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: EAP 6.4.0
Assigned To: Rémy Maucherat
Radim Hatlapatka
Russell Dickenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-09 05:39 EDT by ajustin
Modified: 2014-11-25 06:00 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-11-25 06:00:07 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ajustin 2013-08-09 05:39:06 EDT
JBossWeb 7.2.0.Final

---

 <subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
            <connector name="http1" protocol="HTTP/1.1" scheme="http" socket-binding="http1" redirect-port="8443">
                <virtual-server name="vs1"/>
            </connector>

            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
            </virtual-server>
            <virtual-server name="vs1">
                <alias name="localhost"/>
            </virtual-server>
        </subsystem>

...

        <socket-binding name="http" port="8080"/>
        <socket-binding name="http1" port="8180"/>


Goto "localhost:8180" --> results in 403.
Comment 1 Radim Hatlapatka 2013-08-09 06:31:04 EDT
I have tried it, and I am getting the same resutls as ajustin, but only if I have enable-welcome-root="true" otherwise I am getting for both cases 404

(In my case I used JBoss Web 7.2.1.Final).

Note; If you set the enable-welcome-root="true" via CLI and use only server reload, you start getting 200 responses with web content till you don't restart the EAP server, then it behaves the way as described by ajustin in Comment 0
Comment 2 Jean-frederic Clere 2013-08-23 06:22:13 EDT
-Dorg.apache.catalina.connector.USE_IP_PORT_FOR_ALIAS=true
and use Alias like the following:
            <virtual-server name="vs1">
                <alias name="localhost:8080"/>
            </virtual-server>
            <virtual-server name="vs2">
                <alias name="localhost:8180"/>
            </virtual-server>
Comment 3 Jean-frederic Clere 2013-08-23 11:53:49 EDT
Note the connector have to be associated to one virtual-host but the alias should cover all the hostname/port you want to limit to a connector.
Comment 4 Martin Velas 2014-07-31 09:22:23 EDT
For the latests bits EAP 6.3.0.ER10 the behaviour is the same as described by Radim in Comment 1.
Comment 5 Rémy Maucherat 2014-09-02 12:06:28 EDT
See comments from Jean-Frédéric. Even though a vhost can be "associated" with a connector, all the vhosts mapping is still done in a single place, so the name and aliases must be unique in the web container. Besides, it would also cause issues with internal mapping (ex: rewrite).
Comment 6 Radim Hatlapatka 2014-11-25 06:00:07 EST
I have verified that proposed solution by Jean-Frederic works. I am closing this bug, if you have any objections be free and reopen it.

My configuration looks like this:
  <system-properties>
        <property name="org.apache.catalina.connector.USE_IP_PORT_FOR_ALIAS" value="true"/>
  </system-properties>
...

 <subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
            <connector name="http1" protocol="HTTP/1.1" scheme="http" socket-binding="http1" redirect-port="8443">
                <virtual-server name="vs2"/>
            </connector>

            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost:8080"/>
            </virtual-server>
            <virtual-server name="vs2" enable-welcome-root="true">
              <alias name="localhost:8180"/>
            </virtual-server>
 </subsystem>
...
 <socket-binding name="http" port="8080"/>
 <socket-binding name="http1" port="8180"/>

Note You need to log in before you can comment on or make changes to this bug.