Forum Moderators: phranque
the problem is;
A page from the publisher is requested via our proxy (example.net) : GET http://publisher.com.example.net/pages/paper.shtml
In certain cases they're returning a 302 or 301 and stripping of the example.net, bouncing the client outside of the control of our proxy and therefore to the wrong pages.
I need to
1. Check to see if the request is a 302 or a 301
2. Check to see if the request is from publisher.com
3. If it is, re-insert the .example.net into the request. I.e. transform publisher.com to publisher.com.example.net
Can someone help me with the rules to achieve this?
Thanks.
[edited by: jdMorgan at 4:41 pm (utc) on April 8, 2005]
[edit reason] Examplified per TOS. [/edit]
Welcome to WebmasterWorld!
You could do this with a script, essentially replacing mod_proxy, but it won't be pretty.
The basic problem is that "Check to see if the request is a 301 or 302" is self-contradictory. Specifically, a 301 or 302 is a response, not a request. Since mod_rewrite on a given server operates just after a request is received but before any content-handler is invoked, it has no 'view' of anything after that. As a result, it cannot examine the response from the proxied server to see if the request resulted in a 301 or 302.
There may be some other solution, but I'd tell them to start fixing their code NOW instead of leaving it to you to develop a proxy-replacement using a PERL script and LWP::Simple from scratch.
Jim