From: "Cédric Finance" Date: 2007-11-09T03:40:33+09:00 Subject: Re: Faking the refering page with Mechanize ------=_Part_6824_13676971.1194547226152 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I don't think that you can do what you want this way, the referer is set by your browser not by the website you are browsing. (Moreover, you are changing the referer from the request, not from the response). And I don't see why a server response could have a referer header. If you want to load a page with another referer from your rails app, try to use some javascript to change the referer of the browser or make an ajax page request with the right referer (I think it should be possible to set the header from the ajax request). On Nov 8, 2007 7:23 PM, Ehud Rosenberg wrote: > OK, I'm stupid :) > I don't need mechanize to fake the referring page at all, but rails > itself in a redirect_to statement. > The flow is as such: > a. mechanize retrieves a page and scrapes it for a url > b. a redirect_to to that url is sent back to the cient > c. he goes and fetches the url (only right now he gets redirected since > his referrer is wrong. > > I am trying to do the following to set the referrer: > request.env['HTTP_REFERER'] = 'http://www.something.com > redirect_to "www.site.com" > > but when I sniff the headers, it's still set to my own site... > > Any ideas? > Thanks! > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_6824_13676971.1194547226152--