On Tue, 8 Feb 2011 22:12:29 +0800, "Terry." wrote: > 2011/2/8 Amos Jeffries: > >> >> What exactly are you trying to achieve? >> > > Hi amos, > > Our backend server is a rails framework, the frontend is squid for > reverse proxy. > So I was asking does squid do the stuff of rewrite instead of letting > rails do that. > > Regards. Squid can: * re-write (alter the URL as it passes through without informing the client) CON: only possible for HTTP or FTP or Gopher URLs CON: every absolute URL and 3xx reply generated by the backend will break the website CON: altering anything in the path portion of the URL will break the website CON: cookies and session based security will break ... and a few other cons I forget about, all based on information leakages or mis-match. * redirect a client from URL-a to URL-b PRO: all HTTP features works CON: so-called "private" backend locations are not possible. * route the request to a peer backend service PRO: all HTTP features work CON: backend needs to be aware that its listening IP:port are not in the URLs. All of these are relatively simple to setup. Standard reverse-proxy uses the third option, leaving the 30x redirect to the backend. Though Squid can do 30x as well as needed. Amos