1

I have a domain that's hosted on a server. I want to set up another server to sometimes serve up pages instead of the pages on the first server. How do I set this up?

I guess it's similar to a failover environment, right? My server could serve as a 'gateway' server, showing the pages I have, but if the page doesn't exist on my server, it would maybe trigger a failover event that serves the content from the original server.

Am I on the right track? How would I set something like that up? Or is there a simpler way to do this? (i.e. apache proxypass)

1
  • Setting up proxying on Apache will work well if the directory paths are well defined.
    – BillThor
    Mar 10, 2011 at 17:30

2 Answers 2

1

If I've understood your question correctly...

Catch the 404 and use a script to send a GET request to your other server. If that generates a 404 then you can present a 404 to the user. If it gets a 200 OK (the other server has the page) then you could forward on.

Essentially, you're writing a script that performs a bit of Layer 7 load balancing.

Seems a little bit of a strange request if I'm honest. If you have a second server, you could use Round Robin DNS (easy to set up) to send connections to one server then the other, then the first...etc etc but you need the same content on both servers.

1
  • Thanks! Now I'm trying to do this all without the website visitor knowing they're on a different server. It has to be seamless. Would your suggestion still work? If so, is it possible to do this by simply changing the A records of the domain name to point to the main server, then have the main server do a GET request to the original server on 404 detection? Do I do this in a language like PHP, htaccess alteration, or when you say 'script' do you mean code running at the root apache level? Mar 10, 2011 at 18:09
0

If you have your content split between the servers using separate directory paths, then proxying would be appropriate. If you have pages from the same directory on both servers, use Lewis's solution.

A simple forward proxy may be all you need. Consider caching on the front-end server.

2
  • On one server, the entire website is there. On the other server, a couple of the pages are there in a modified form. I want when people visit the site to show the page on the first server if it exists, but to default to the second server (the one with the entire website) if it doesn't. Mar 10, 2011 at 18:03
  • @Andy Livingston: Then I think a 404 handler like Lewis suggested is what you need. Seems like a strange setup to me.
    – BillThor
    Mar 11, 2011 at 2:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .