Relative links between two servers?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I need some advice on a sitauation I've never had to deal with before. I
have a client with a high traffic site currently located on a dedicated
Linux server. They are thinking about adding a second dedicated server
and moving half to three quarters of their files to the second one. They
will name them server1 and server2 but will only be using one domain name.

The files currently all have relative links in them. My questions are

A.) would all the relative links need to be rewritten regardless of
which server was involved even if the page calling the file and the
called file itself are still on the same server or would the relative
link still work this way?

B.) would I be correct that anything that was being called cross-server
would definitely have to be changed from /example.html to something like if the calling page was on server
1 and the called page was on server2 ?

Is there an easier way of accomplishing these link changes that I am

Re: Relative links between two servers?

Quoted text here. Click to load it

Don't do that - use load balancing instead. Keep the names simple,
split requests out dynamically. This is dead easy (well-established
technique) and has advantages for robustness after hardware failure.

The only time it gets awkward is if you use server-side sessions -
splitting the "time period spent browsing a site" doesn't care which
machine serves the request, but it might care if there's a server-side
session token that only resides on one machine. There are techniques
to work around this too: best is to be "RESTful" (it just doesn't
matter, because there is no spoon), otherwise some of the load
balancers have smarts to make a client IP address become "sticky" to
just one server for the duration.

Quoted text here. Click to load it

So what does "server" mean here?  Do you mean "physical box", or do
you mean "piece of URL namespace" or "hostname" ?  HTTP only sees
addresses (URLs, and the hostname within them) not physical kit.

If you mean hostname (including subdomains, e.g. vs. than HTTP sees these as different things. You
need absolute addressing. It's pretty obvious really - how could you
even represent this hard-coded split in the site structure without
putting the machines' names into it? The syntax of URLs would then
force you into using absolute addresses - there's nowhere to fit the
hostname into a relative one.

Physical boxes sharing the workload of the same adddress space (i.e.
real load balancing) are the same address space. QED. No problemo.

Boxes splitting the same domain into two namespaces but _not_ going so
far as to use different hostnames (i.e. and /) are perverse and freaky. You can't do
this (without building a name-aware load balancer as a front-end, and
why would you do that?). In _this_ case alone, then you might think
you had this problem to worry about - but as you can't easily
represent this problem, there's no need to look for solutions to it.

Re: Relative links between two servers?

Andy Dingley wrote:
Quoted text here. Click to load it

I would have to second that - it's the first thing that came to mind
when I saw the OP's request...

Re: Relative links between two servers?

Quoted text here. Click to load it

I don't see why *any* would need to be changed if they don't include the
server name.

Quoted text here. Click to load it

No.  It depends entirely on how you're partitioning the files in
question.  You could, for example, easily do a redirect of all requests to a server.  It all
boils down to how much logic you put into partitioning the work load and
how much of it you want to be tied into the server configuration rather
than the HTML files.

My personal UDP list:,,,,, localhost,,,,

Site Timeline