On Jan 17, 2014, at 06:05 , Paul Cowan <co...@caucho.com> wrote:

> On Jan 16, 2014, at 4:32 PM, Rick Mann <rm...@latencyzero.com> wrote:
>> I'm trying to update a virtual server that runs a handful of webapps in 
>> Resin. The old machine was "tycho.latencyzero.com" and a bunch of DNS 
>> entries point to it. The web apps are configured to respond to those varying 
>> hostnames. The new machine temporarily has the name "stage.latencyzero.com."
>> I copied everything from the old machine to the new, including the resin 
>> config file. Obviously, I can't just go to "stage.latencyzero.com", because 
>> resin has no idea which webapp I really want.
>> Is there any way to configure resin to rewrite a request with a host like 
>> "foo.bar.latencyzero.com.stage.latencyzero.com" into a request for the 
>> webapp that responds to "foo.bar.latencyzero.com," while keeping the actual 
>> hostname intact for the purposes of rendering links in the pages, etc.?
> Hi Rick,
> I'm not exactly understanding what you want to do, but it sounds like I a 
> similar situation I had on one of my sites.  This configuration below is what 
> I used.  The new real host is listed first in resin.xml, then the default 
> host id="" with host-alias * will catch all, and the redirect regex will 
> redirect to the new site while appending the requested URI.
>     <host id="foo" root-directory="hosts/foo">
>       <host-alias-regexp>.*foo.com</host-alias-regexp>
>       …
>     </host>
>     <host id="" root-directory="hosts/default">
>       <host-alias>*</host-alias>
>       <web-app id="/" root-directory="webapps/ROOT">
>         <resin:Redirect regexp="(.*)" target="http://www.foo.com$1"/>
>         <resin:Redirect regexp="(.*)" target="https://www.foo.com$1";>
>           <resin:IfSecure value="true"/>
>         </resin:Redirect>
>       </web-app>
>     </host>
> Hope this helps,

Hmm, not sure. Basically, I have entries in resin.xml on machine 
"tycho.latencyzero.com" like this:

    <host host-name="latencyzero.com" 
        <web-app id="/" document-directory="www"></webapp>
    <host id="comics\.roderickmann\.org\.?" 
        <web-app id="/" document-directory="."></webapp>

    <host host-name="www.roderickmann.org" 
        <web-app id="/" document-directory="."></webapp>

    <host host-name="mgfb.roderickmann.org" 
        <web-app id="/" document-directory="."></webapp>

I have DNS entries for all of the above that are all CNAMEs to 

I want to move all of those apps to a new machine (upgrading hardware and OS), 
but I want to test it first. The machine is called stage.latencyzero.com, and I 
need to make new DNS entries for each webapp (perhaps adding "stage" to each 
name, or something). The most straightforward thing would be simply to modify 
each name to add "stage" to them, but then when I decide to make the new 
machine permanent, and change all the old DNS entries to point to the new IP 
address, I'd have to modify the entries.

Or I could simply add host-aliases for all the new names.

But I was hoping there'd be a trick so that I only have to modify one line, and 
each of the host entries would pick it up. I realize that might require me to 
modify all the entries once (as you did with your redirects). But once I do 
this once, it should work for similar changes in the future.

One thing I need to preserve: if I'm hitting one of my webapps through the new 
name (e.g. "stage.mgfb.roderickmann.org" or whatever), when code in the webapp 
uses the host name to render URIs, it needs to use that same hostname, so that 
links point to the right place, and not back to the old instance.

All this discussion, of course, has taken longer than it would have to simply 
modify the entries a couple times, but I was curious.


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

resin-interest mailing list

Reply via email to