Graham Leggett wrote: > > Mohamed Elashmawy wrote: > > > I've setup the reverse proxy. > > Is there a way to make apache change the absolute URLs. > > I mean that there are links that are sent to the client through the > > reverse proxy that point to the web server (absoute not relative) so > > when they are pressed they send the user to the webserver (They are not > > actually links but redirections but it's the same case) > > Are you talking about URLs embedded inside the pages themselves? There > isn't a way of doing this (to my knowledge) just with Apache - however > trying to filter the URLs within the content is a bad idea, as there are > so many ways of getting it wrong. > > First prize is to make sure all the links are relative. If this is not > possible, change the URLs so that they are absolute but without > hostnames, eg "/images/someimage.gif". > > A good rule of thumb is to make the URL on the backend always the same > as the URL on the frontend, for example: > > ProxyPass /images/ http://backend.com/images/ > > Then everything will just work...
Another option, though potentially somewhat political, is to hijack the domain name of the backend server. For example, change backend.mydomain.com to backend_a.mydomain.com and have all urls on this site be FQ urls http://backend.mydomain.com/images/foo.jpg. Repoint the backend.mydomain.com name to proxy.mydomain.com. Set up a mod_rewrite rule such that http://backend.mydomain.com/images/foo.jpg rewrites to http://proxy.mydomain.com/backend/images/foo.jpg. Then proxy /backend to http://backend_a.mydomain.com Political because someone's gotta give up their name. Ugly, yes. A mess, yes again. Process intensive? Without doubt. Sometimes there are no easy answers. BTW, I've been looking for a solution to this problem myself. Shame you can't do it from within mod_proxy. -- Chris -- Guvf vf zl qvtvgnyyl raunaprq rapelcgrq fvtangher.
