<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Well, I got this working and
it's pretty nice too. I just wanted to post a couple notes here in the
hope they may help someone else who needs to do this.<br>
relevant config looks like this,<br>
<br>
&nbsp;location ~ \.php$ {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_set_header WhatSlave $host;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($request_method = 'POST') {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass <a class="moz-txt-link-freetext" href="http://theserverwiththedata.com">http://theserverwiththedata.com</a>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fastcgi_pass 127.0.0.1:9000; include fastcgi_params;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
Notice I added a set header line. This was because in some cases the
master server needs to know where the request was proxied from. In some
cases it needs to do a redirect, eg. secure login. And that set header
line causes a header to appear in the $_SERVER variable with the HTTP_
prefix. eg. HTTP_WHATSLAVE and has value of the host without http
prefix.<br>
<br>
Of course, the master server is running mysql replication and the data
saved during the POST comes back to the slave server pretty quickly. In
this setup all the GET requests drop through to the fastcgi locally and
access the data on the slave. The POST requests pas up to modify data
on the master. Good idea: give the local mysql user only "select"
privileges to make sure it doesn't nasty up the local data. If you
allow altering data locally when doing replication you will create big
headaches sooner or later.<br>
<br>
Chris :)<br>
</font>
</body>
</html>