Conditionnal proxying new plone over old plone

Hello,
I have a very old plone4 site with many pages ; this site does not migrate easily to plone5, furthermore, some pages may not be relevant in the future new site.

I would like to be able to have the new plone5 site and the old plone4 site running at the same time, and to have a frontend that would display the new site if the page exists there otherwise it would display the old site. This should let me transfer folders from the old site to the new site one at a time, thus performing a smmooooth migration.

I gave a small try with apache2 mod_rewrite but I was not successful, has anybody succeeded with this 'feature' before ?

Thanks

Fred

add this line just before your current RewriteRule line for Plone:


RewriteRule ^/myoldsite(.*) http://ipaddr:port/VirtualHostBase/https/newsite.domain.xyz:443/<path to instance in Zope>/VirtualHostRoot/_vh_<outside name>$1 [L,P,E=remoteUser:%{LA-U:REMOTE_USER}]

In this way, people can reach the old site going to newsite.domain.xyz/<outside name>

Completely off topic, but I once had a similar problem which made me make this:

We did this with Varnish using dynamic backend selection mechanism. If the new site replies with 404 it changes the backend to the old site and makes the backend request there.

3 Likes

Some time ago i did 'something' like this in nginx:

 location @404{
            rewrite  ^ https://OLDURL$request_uri ;
        }

Thank you for your hints ; i gave varnish a try and it seems to work the way i want it :wink:

Varnish conf file :

backend  plone5 {
    .host = "127.0.0.1";
    .port = "90";
}
backend plone4 {
    .host = "127.0.0.1";
    .port = "89";
}
sub vcl_backend_response {
     
    if ( beresp.status==404 ) {
       set bereq.backend = plone4 ;
 
      return(retry);
    }
}


1 Like

And what does this Varnish vcl do if the Plone 4 backend also return a 404?

More organisational / long term: this is a cool technical solution ‘per page’, but how are you going to phase out the Plone 4 site? Clean up all old pages on the Plone 4 site one by one and recreate them with the same path and Id on the new site? Image and other resources used on thoss pages?

Plone 4 has been out of support for a whole already but is still installable with extra effort. That will however become more and more difficult in the next years. By ‘entangling’ the content trees like this you’ll have to have a clear strategy/plan up front how you are going to migrate out of it. And who is going to do which work when ans how.

We did this along these lines:

sub vcl_backend_fetch {
    if (bereq.retries > 0) {

        if (bereq.url ~ "<site url>") {
            set bereq.backend = oldsite.backend();
        }

    }
    return(fetch);
}

I have been struggling and failing with the migration from 4 to 5, so i gave up the 'traditionnal way' of upgrade. ( my plone 4 started as a plone 1.9 or 2 20 years ago )

The plan :
What i plan to do is to move the different 'top folders' which will be moved with the 'collective.exportimport addon' from the 4 to the 5 ... and then phase out the old instance ... minimizing the work for the authors ; and becasue it can be done on a long time scale, the administrators should be able to cope with the work load