Bug 995411 - Virtual Server cannot take "localhost" as alias more then once
Summary: Virtual Server cannot take "localhost" as alias more then once
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: EAP 6.4.0
Assignee: Rémy Maucherat
QA Contact: Radim Hatlapatka
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-09 09:39 UTC by ajustin
Modified: 2014-11-25 11:00 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-25 11:00:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description ajustin 2013-08-09 09:39:06 UTC
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 10:31:04 UTC
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 10:22:13 UTC
-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 15:53:49 UTC
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 13:22:23 UTC
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 16:06:28 UTC
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 11:00:07 UTC
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.