Is it possible to make Savon allow redirects? I am currently receiving a 302 HTTP Error, but in reality this should just be a redirect instead of an error.
Asked
Active
Viewed 1,263 times
2 Answers
2
You can setup Savon to follow redirect setting up follow_redirects option to true.
Eg: client = Savon.client(wsdl: url, ssl_verify_mode: :none, follow_redirects: true)
Found here: https://github.com/savonrb/savon/issues/243

Mauricio Suaza
- 21
- 2
1
Savon uses httpi for the connection. httpi itself is a wrapper around curb, em_http, excon, httpclient, net_http and rack.
The file em_http.rb
contains the comment that
automatic redirect following
is not supported by httpi. So what I would try to send the call to the redirection target right away if that's possible.
To find the "real" URL you can use a tool like curl
, for example:
curl -I www.yahoo.in
gives you
HTTP/1.1 301 Moved Permanently
Date: Thu, 18 Aug 2016 18:50:05 GMT
...
Cache-Control: max-age=3600, public
Location: http://in.yahoo.com/
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
Age: 0
Connection: keep-alive
Server: ATS
The Location:
key shows the address you want to try next. You might get another redirect. You'll have to try until the 200 OK
is returned.

Steffen Roller
- 3,464
- 25
- 43
-
How does one figure out the redirect url from the savon request? – tol4trob Sep 04 '14 at 16:11
-
I think I used `curl -v` – Steffen Roller Sep 05 '14 at 19:18
-
@Steffen Roller Hi Steffen I am getting this error could you please help me how to resolve this. – anusha Aug 17 '16 at 12:49
-
I added some explanation how to get there. – Steffen Roller Aug 18 '16 at 18:54