Discussion:
[Exist-open] Multi homed websites
Alasdair Dougall
2017-05-30 00:32:57 UTC
Permalink
Coming on the tail of the question from Dannes Wessels, I am having an
issue in setting up multiple homed websites within eXist 3.2.

With the 2.x version we would set tools/jetty/etc/jetty.xml and adjust the
following:

<New id="exist-webapp-context" class="org.exist.jetty.WebAppContext">
<!-- can either be '/exist' or '/' UPDATED to single slash -->
<Set name="contextPath">/</Set>.
<Set name="war.......

So, in 3.2 we have the same, tools/jetty/webapps/exist-webapp-context.xml:

<Configure id="exist-webapp-context" class="org.exist.jetty.WebAppContext">
<!-- contextPath can be set to either '/exist' or '/' UPDATED to single
slash -->
<Set name="contextPath">/</Set>
<Set name="war"><Pro........


Now, the question is how to be able to have multiple '/' rooted websites,
as in www.foodiesite.com and www.artandphotos.co.uk. That is having the
ability to host several websites on a server *without* the need to have
http://website/example1/index.html

To achieve this on eXist 2.x, I would change controller-config.xml to map
the domains as following:

<root server-name="www.foodiesite.com" pattern="/*"
path="xmldb:exist:///db/apps/foodiesite/"/>

Is the above the best way to achieve the multi-root homed websites? As to
date, I am not able to get the local instance to load foodiesite.local:8080
to load the local Foodiesite site to load, but localhost:8080 loads the
dashboard.

Thanks in advance.

Alasdair
Adam Retter
2017-05-30 17:54:03 UTC
Permalink
I would avoid doing the multi-homing at the eXist level, but instead use a
reverse proxy up-front to do the routing that you need.
Post by Alasdair Dougall
Coming on the tail of the question from Dannes Wessels, I am having an
issue in setting up multiple homed websites within eXist 3.2.
With the 2.x version we would set tools/jetty/etc/jetty.xml and adjust the
<New id="exist-webapp-context" class="org.exist.jetty.WebAppContext">
<!-- can either be '/exist' or '/' UPDATED to single slash -->
<Set name="contextPath">/</Set>.
<Set name="war.......
<Configure id="exist-webapp-context" class="org.exist.jetty.
WebAppContext">
<!-- contextPath can be set to either '/exist' or '/' UPDATED to
single slash -->
<Set name="contextPath">/</Set>
<Set name="war"><Pro........
Now, the question is how to be able to have multiple '/' rooted websites,
as in www.foodiesite.com and www.artandphotos.co.uk. That is having the
ability to host several websites on a server *without* the need to have
http://website/example1/index.html
To achieve this on eXist 2.x, I would change controller-config.xml to map
<root server-name="www.foodiesite.com" pattern="/*"
path="xmldb:exist:///db/apps/foodiesite/"/>
Is the above the best way to achieve the multi-root homed websites? As to
date, I am not able to get the local instance to load foodiesite.local:8080
to load the local Foodiesite site to load, but localhost:8080 loads the
dashboard.
Thanks in advance.
Alasdair
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
https://lists.sourceforge.net/lists/listinfo/exist-open
--
Adam Retter

eXist Developer
{ United Kingdom }
***@exist-db.org
irc://irc.freenode.net/existdb
Dannes Wessels
2017-05-30 18:04:11 UTC
Permalink
Thnx Adam, I was about to answer the same.

Regards

Dannes

--
www.exist-db.org
I would avoid doing the multi-homing at the eXist level, but instead use a reverse proxy up-front to do the routing that you need.
Alasdair Dougall
2017-06-01 02:19:35 UTC
Permalink
Hi,
Post by Adam Retter
I would avoid doing the multi-homing at the eXist level, but instead use a
reverse proxy up-front to do the routing that you need.
Ok, so avoiding multi-homing at the eXist level, enabled proxy to allow
proxy pass to work on Apache 2.4.25 (Mac Sierra)

I also added the following VHost entry:

<VirtualHost *:80>
ProxyRequests off
ServerName foodiesite.local
ServerAlias www.foodiesite.local
ProxyPass / http://localhost:8080/exist/apps/foodiesite
ProxyPassReverse / http://localhost:8080/exist/apps/foodiesite
ProxyPassReverseCookieDomain localhost foodiesite.local
ProxyPassReverseCookiePath /exist /
RewriteEngine on
RewriteRule ^/(.*)$ /$1 [PT]
</VirtualHost>

To confirm the ProxyPass URL was correct, I checked
http://localhost:8080/exist/apps/foodiesite in the browser and got the
homepage, bar the referenced Uris, e.g., /images/mainpage/xxxx.jpg and the
like.

I have the following host entry, so the address is resolved:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 foodiesite.local www.foodiesite.local
::1 foodiesite.local www.foodiesite.local

Ping to Foodiesite.local resolves successfully.

So, all should be good, except I get 'Too many redirects' when I enter
http://foodiesite.local and I also get two extra slashes, i.e.
http://foodiesite.local// in the address bar.

Has anyone any ideas on the above behaviour and any ideas on how to resolve?

(Just to make sure I am getting to eXist Jetty instance, I added some
random text to the end of the ProxyPass url and got the Jetty error message
'Document not found.')

Thanks in advance
Adam Retter
2017-06-02 14:48:32 UTC
Permalink
Hi Alasdair,

I am afraid I am no familiar with Apache httpd these days, so I can't help
you there. You would need to trace this with Chrome developertools,
tcpdump, Wireshark or similar to understand what is happening.
Post by Alasdair Dougall
Hi,
Post by Adam Retter
I would avoid doing the multi-homing at the eXist level, but instead use a
reverse proxy up-front to do the routing that you need.
Ok, so avoiding multi-homing at the eXist level, enabled proxy to allow
proxy pass to work on Apache 2.4.25 (Mac Sierra)
<VirtualHost *:80>
ProxyRequests off
ServerName foodiesite.local
ServerAlias www.foodiesite.local
ProxyPass / http://localhost:8080/exist/apps/foodiesite
ProxyPassReverse / http://localhost:8080/exist/apps/foodiesite
ProxyPassReverseCookieDomain localhost foodiesite.local
ProxyPassReverseCookiePath /exist /
RewriteEngine on
RewriteRule ^/(.*)$ /$1 [PT]
</VirtualHost>
To confirm the ProxyPass URL was correct, I checked
http://localhost:8080/exist/apps/foodiesite in the browser and got the
homepage, bar the referenced Uris, e.g., /images/mainpage/xxxx.jpg and the
like.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 foodiesite.local www.foodiesite.local
::1 foodiesite.local www.foodiesite.local
Ping to Foodiesite.local resolves successfully.
So, all should be good, except I get 'Too many redirects' when I enter
http://foodiesite.local and I also get two extra slashes, i.e.
http://foodiesite.local// in the address bar.
Has anyone any ideas on the above behaviour and any ideas on how to resolve?
(Just to make sure I am getting to eXist Jetty instance, I added some
random text to the end of the ProxyPass url and got the Jetty error message
'Document not found.')
Thanks in advance
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
https://lists.sourceforge.net/lists/listinfo/exist-open
--
Adam Retter

eXist Developer
{ United Kingdom }
***@exist-db.org
irc://irc.freenode.net/existdb
Loading...