Multi homed websites

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Multi homed websites

adougall
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




------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Multi homed websites

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.

On 29 May 2017 at 20:32, Alasdair Dougall <[hidden email]> wrote:
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




------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open




--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Multi homed websites

Dannes Wessels-3
Thnx Adam, I was about to answer the same.

Regards

Dannes

--
www.exist-db.org

> On 30 May 2017, at 19:54, Adam Retter <[hidden email]> wrote:
>
> 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.

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Multi homed websites

adougall
In reply to this post by adougall
Hi,


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

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Multi homed websites

Adam Retter
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.

On 31 May 2017 at 22:19, Alasdair Dougall <[hidden email]> wrote:
Hi,


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

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open




--
Adam Retter

eXist Developer
{ United Kingdom }
[hidden email]
irc://irc.freenode.net/existdb

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open