Website migration using Varnish?

Tobias Eichelbrönner tobias.eichelbroenner at lamp-solutions.de
Mon Aug 12 15:13:35 CEST 2013


Hi,

> My plan is to use varnish in order to fetch Tomcat (or Apache->Tomcat)
> pages from the new application and deliver all urls not found on the new
> application from the old php application.

my first idea would to build a custom error page and redirect all failed
requests from the Java-Website to the old php website.
This is easier if you can use different (sub)domains for the old and the
new page.

The error vcl-code would look something like this (untested)

sub vcl_error {
   if(obj.http.host == "my_java_backend.tld
    set obj.http.Content-Type = "text/html; charset=utf-8";
    set obj.http.Location = "http://my_php_backend.tld/" + req.url;
    set obj.status = 301;#moved permanently
    return(deliver);
  }
}

Sincerely,

Tobias

-- 
LAMP solutions GmbH
Gostenhofer Hauptstrasse 35
90443 Nuernberg

Amtsgericht Nuernberg: HRB 22366
Geschaeftsfuehrer: Heiko Schubert

Es gelten unsere allgemeinen Geschaeftsbedingungen.
http://www.lamp-solutions.de/agbs/

Telefon      : 0911 / 376 516 0
Fax          : 0911 / 376 516 11
E-Mail       : support at lamp-solutions.de
Web          : www.lamp-solutions.de
Facebook     : http://www.facebook.com/LAMPsolutions
Twitter      : http://twitter.com/#!/lampsolutions



More information about the varnish-misc mailing list