Re: [Resin-interest] "Rewriting" hostnames across webapps?

2014-01-17 Thread Rick Mann
Yep, I think it would. The problem is, what if I want a more complex 
transformation next time? Or just a different string other than "stage" 
inserted?

It's okay, this works well enough for me now.

On Jan 17, 2014, at 15:24 , Chris Pratt  wrote:

> Wouldn't adding "(stage\.)?" to each host-alias-regexp and changing the 
> host-name to regexp allow it to work as you want it?  For example:
> 
>  root-directory="/lz/var/www/com/latencyzero">
> 
> ^tycho.(stage\.)?latencyzero.com[\.]?$
> 
> ^(www\.)?(stage\.)?latencyzero.com[\.]?$
> 
> 
> 
> 
> On Fri, Jan 17, 2014 at 3:18 PM, Rick Mann  wrote:
> 
> On Jan 17, 2014, at 06:05 , Paul Cowan  wrote:
> 
> >
> > On Jan 16, 2014, at 4:32 PM, Rick Mann  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.
> >
> > 
> >   .*foo.com
> >   …
> > 
> >
> > 
> >   *
> >   
> > http://www.foo.com$1"/>
> > https://www.foo.com$1";>
> >   
> > 
> >   
> > 
> >
> > Hope this helps,
> 
> Hmm, not sure. Basically, I have entries in resin.xml on machine 
> "tycho.latencyzero.com" like this:
> 
>  root-directory="/lz/var/www/com/latencyzero">
> ^tycho.latencyzero.com[\.]?$
> ^(www\.)?latencyzero.com[\.]?$
> 
> 
> 
>  root-directory="/lz/var/www/org/roderickmann/comics">
> comics.roderickmann.org
> 
> 
> 
>  root-directory="/lz/var/www/org/roderickmann/www">
> ^(www\.)?roderickmann.org[\.]?$
> ^(www\.)?rickmann.org[\.]?$
> 
> 
> 
>  root-directory="/lz/var/www/org/roderickmann/mgfb">
> ^mgfb\.roderickmann.org[\.]?$
> ^blog\.roderickmann.org[\.]?$
> 
> 
> 
> I have DNS entries for all of the above that are all CNAMEs to 
> tycho.latencyzero.com.
> 
> 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.
> 
> Thanks,
> Rick
> 
> 
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
> 
> 
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest


-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/lis

Re: [Resin-interest] "Rewriting" hostnames across webapps?

2014-01-17 Thread Chris Pratt
Wouldn't adding "(stage\.)?" to each host-alias-regexp and changing the
host-name to regexp allow it to work as you want it?  For example:


^tycho.(stage\.)?latencyzero.com[\.]?$
^(www\.)?(stage\.)?latencyzero.com[\.]?$




On Fri, Jan 17, 2014 at 3:18 PM, Rick Mann  wrote:

>
> On Jan 17, 2014, at 06:05 , Paul Cowan  wrote:
>
> >
> > On Jan 16, 2014, at 4:32 PM, Rick Mann  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.
> >
> > 
> >   .*foo.com
> >   …
> > 
> >
> > 
> >   *
> >   
> > http://www.foo.com$1"/>
> > https://www.foo.com$1";>
> >   
> > 
> >   
> > 
> >
> > Hope this helps,
>
> Hmm, not sure. Basically, I have entries in resin.xml on machine "
> tycho.latencyzero.com" like this:
>
>  root-directory="/lz/var/www/com/latencyzero">
> ^tycho.latencyzero.com
> [\.]?$
> ^(www\.)?latencyzero.com
> [\.]?$
> 
> 
>
>  root-directory="/lz/var/www/org/roderickmann/comics">
> comics.roderickmann.org
> 
> 
>
>  root-directory="/lz/var/www/org/roderickmann/www">
> ^(www\.)?roderickmann.org
> [\.]?$
> ^(www\.)?rickmann.org[\.]?$
> 
> 
>
>  root-directory="/lz/var/www/org/roderickmann/mgfb">
> ^mgfb\.roderickmann.org
> [\.]?$
> ^blog\.roderickmann.org
> [\.]?$
> 
> 
>
> I have DNS entries for all of the above that are all CNAMEs to
> tycho.latencyzero.com.
>
> 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.
>
> Thanks,
> Rick
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] "Rewriting" hostnames across webapps?

2014-01-17 Thread Rick Mann

On Jan 17, 2014, at 06:05 , Paul Cowan  wrote:

> 
> On Jan 16, 2014, at 4:32 PM, Rick Mann  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.
> 
> 
>   .*foo.com
>   …
> 
> 
> 
>   *
>   
> http://www.foo.com$1"/>
> https://www.foo.com$1";>
>   
> 
>   
> 
> 
> Hope this helps,

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


^tycho.latencyzero.com[\.]?$ 

^(www\.)?latencyzero.com[\.]?$   





comics.roderickmann.org  




^(www\.)?roderickmann.org[\.]?$  

^(www\.)?rickmann.org[\.]?$  





^mgfb\.roderickmann.org[\.]?$

^blog\.roderickmann.org[\.]?$




I have DNS entries for all of the above that are all CNAMEs to 
tycho.latencyzero.com.

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.

Thanks,
Rick



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] "Rewriting" hostnames across webapps?

2014-01-17 Thread Paul Cowan

On Jan 16, 2014, at 4:32 PM, Rick Mann  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.


  .*foo.com
  …



  *
  
http://www.foo.com$1"/>
https://www.foo.com$1";>
  

  


Hope this helps,

-Paul



> 
> Is there another technique to make this kind of migration easier?
> 
> I did manually edit resin.xml for one of my webapps to respond to 
> "comics.stage.roderickmann.org," and created a DNS entry to match. But it can 
> be tedious to change them all (not too bad, really, just looking for a nicer 
> way).
> 
> Eventually, all the "stage" nonesense will go away and the new machine will 
> completely replace the old and the old will go away.
> 
> -- 
> Rick
> 
> 
> 
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest

===
Paul Cowan, Software Engineer
Caucho Technology
co...@caucho.com
http://blog.caucho.com
http://twitter.com/cauchoresin

___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] "Rewriting" hostnames across webapps?

2014-01-16 Thread Rick Mann
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.?

Is there another technique to make this kind of migration easier?

I did manually edit resin.xml for one of my webapps to respond to 
"comics.stage.roderickmann.org," and created a DNS entry to match. But it can 
be tedious to change them all (not too bad, really, just looking for a nicer 
way).

Eventually, all the "stage" nonesense will go away and the new machine will 
completely replace the old and the old will go away.

-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-08 Thread Joe Dane
Take this, coming from someone who has used mod_rewrite quite a bit  
and rewrite-dispatch not at all, for what it's worth.

There is no way you're going to be able to use resin's rewriting as a  
replacement for mod_rewrite.  mod_rewrite is very nearly a little  
programming language in itself, with conditionals, loops, and lots of  
hooks into headers, the filesystem, the current time, and just about  
anything else.  rewrite-dispatch, as I understand it, is vastly  
simpler and less powerful.  It's just meant to be a handy way of  
using a regexp to handle classes of URLs.

You may want to have a look here:

   http://tuckey.org/urlrewrite/

which claims to be a "very powerful tool just like Apache's  
mod_rewrite".  I've not used it myself, but I expect it'll do more  
than resin's built-in rewriting.

On Sep 7, 2007, at 8:06 PM, Jan Kriesten wrote:

>
> hi scott,
>
>> That's odd.  It looks like we're not handling the query string
>> portion.  I've just added a bug report at http://bugs.caucho.com/
>> view.php?id=1997
>
> i didn't mean to report a bug. :-)
>
> i need some example how to do such rewriting with caucho's rewrite- 
> dispatch,
> especially how to check for file existence.
>
> best regards, --- jan.
>
>
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest

-- 

joe





___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-07 Thread Jan Kriesten

hi scott,

> That's odd.  It looks like we're not handling the query string  
> portion.  I've just added a bug report at http://bugs.caucho.com/ 
> view.php?id=1997

i didn't mean to report a bug. :-)

i need some example how to do such rewriting with caucho's rewrite-dispatch,
especially how to check for file existence.

best regards, --- jan.




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-07 Thread Scott Ferguson

On Sep 7, 2007, at 12:24 AM, Jan Kriesten wrote:

>
> why using an example url when not using it... ;-)
>
>> suppose the user calls a url like
>> http://www.myservice.com/en/about/company/?page-id=2
>
> the effective request after applying the rules would be
>
> /index.jsp?pathinfo=/en/about/company/&page-id=2

That's odd.  It looks like we're not handling the query string  
portion.  I've just added a bug report at http://bugs.caucho.com/ 
view.php?id=1997

-- Scott

>
>
> regards, --- jan.
>
>
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-07 Thread Jan Kriesten

why using an example url when not using it... ;-)

> suppose the user calls a url like
> http://www.myservice.com/en/about/company/?page-id=2

the effective request after applying the rules would be

/index.jsp?pathinfo=/en/about/company/&page-id=2


regards, --- jan.




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-07 Thread Jan Kriesten

hi scott,

> I can't quite see what's it's supposed to do.

hehe - seems like you never fiddled with apache rewrite-rules. ;-)

but, here we go.

suppose the user calls a url like

http://www.myservice.com/en/about/company/?page-id=2

RewriteCond checks "if" condition is matched, so the rules at the end should be
applied.

>> RewriteCond   /usr/local/www/services/apache/html% 
>> {REQUEST_FILENAME} !-f

translated: only continue if the requested file doesn't exist in the path.

>> RewriteCond   %{QUERY_STRING} .*

translated: take any query string (later referred to as %0).

>> RewriteCond   %{REQUEST_FILENAME} !.gif$
>> RewriteCond   %{REQUEST_FILENAME} !.jpg$
>> RewriteCond   %{REQUEST_FILENAME} !.js$
>> RewriteCond   %{REQUEST_FILENAME} !.css$

translated: requested filenames don't end with .gif, .jpg, .js or .css

>> RewriteRule   ^(.+)$  $0#%0  [C]

translated: take the request and make a string from it to have
'requestpath#querystring' - then apply the next rule to this result.

>> RewriteRule   ^([^#]+)#(.*)$  /index.jsp?pathinfo=$1&$2   
>> [PT,L]

make '/index.jsp?pathinfo=requestpath&querystring' from
'requestpath#querystring', then take this as the requested url.


regards, --- jan.




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] rewriting...

2007-09-06 Thread Scott Ferguson

On Sep 6, 2007, at 12:27 AM, Jan Kriesten wrote:

>
> hi,
>
> i'm coming from apache and want to change to resin completely since  
> there is no
> need for this intermediate any more.
>
> the only thing i haven't figured out yet is how to use resin's
> . we use apache's rewrite-rules to use user  
> friendly url's. we
> have this e.g.:
>
> RewriteEngine on
> RewriteCond   /usr/local/www/services/apache/html% 
> {REQUEST_FILENAME} !-f
> RewriteCond   %{QUERY_STRING} .*
> RewriteCond   %{REQUEST_FILENAME} !.gif$
> RewriteCond   %{REQUEST_FILENAME} !.jpg$
> RewriteCond   %{REQUEST_FILENAME} !.js$
> RewriteCond   %{REQUEST_FILENAME} !.css$
> RewriteRule   ^(.+)$  $0#%0  [C]
> RewriteRule   ^([^#]+)#(.*)$  /index.jsp?pathinfo=$1&$2   
> [PT,L]
>
> is there a way to accomplish this with resin's ?

Can you translate that into english? :-)

I can't quite see what's it's supposed to do.

-- Scott


>
> best regards, --- jan.
>
>
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] rewriting...

2007-09-06 Thread Jan Kriesten

hi,

i'm coming from apache and want to change to resin completely since there is no
need for this intermediate any more.

the only thing i haven't figured out yet is how to use resin's
. we use apache's rewrite-rules to use user friendly url's. we
have this e.g.:

RewriteEngine on
RewriteCond   /usr/local/www/services/apache/html%{REQUEST_FILENAME} !-f
RewriteCond   %{QUERY_STRING} .*
RewriteCond   %{REQUEST_FILENAME} !.gif$
RewriteCond   %{REQUEST_FILENAME} !.jpg$
RewriteCond   %{REQUEST_FILENAME} !.js$
RewriteCond   %{REQUEST_FILENAME} !.css$
RewriteRule   ^(.+)$  $0#%0  [C]
RewriteRule   ^([^#]+)#(.*)$  /index.jsp?pathinfo=$1&$2  [PT,L]

is there a way to accomplish this with resin's ?

best regards, --- jan.




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest