# Ensure a REST redirection is not relative

**URL:** <https://www.ruby-forum.com/t/ensure-a-rest-redirection-is-not-relative/130709>\
**Category:** Rails\
**Created:** [March 2, 2008, 9:48am UTC](https://www.ruby-forum.com/t/ensure-a-rest-redirection-is-not-relative/130709 "2008-03-02T09:48:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatyree](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f14d63/32.png) [@tatyree](https://www.ruby-forum.com/u/tatyree)\
**Post date:** [March 2, 2008, 9:48am UTC](https://www.ruby-forum.com/t/ensure-a-rest-redirection-is-not-relative/130709/1 "2008-03-02T09:48:03Z")

</div>

Hi,

I’ve got a problem with a RESTful redirect causing Nokia series 40  
phones to go in to spasms. When a user logs in to our service (using  
restful\_authentication), they are redirected to their homepage via a  
redirect\_to homes\_url call. The problem is that, for some reason, in  
this context, homes\_url generates ‘/homes’ and not ‘[http://server/](http://server/)  
homes’ . Now Nokia decrees that relative redirects are a sin of the  
second highest order and immediately warns the user that they are  
‘about to send data to another server’.

Now, I know I can just pass the absolute URL to the redirect\_to, but  
this breaks the otherwise DRY nature of the code so far as I will need  
to manually account for the boxes in the cluster for this one link.

My question, then, is: is there anyway to force homes\_url (or any  
RESTFUL route) to return an absolute URL? Strangely, it does seem  
that the same call generates absolute URLs when used with other  
methods, such as link\_to.

Thanks,  
Todd

---

<div class="post-metadata">

**Author:** ![tatyree](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f14d63/32.png) [@tatyree](https://www.ruby-forum.com/u/tatyree)\
**Post date:** [March 2, 2008, 11:59am UTC](https://www.ruby-forum.com/t/ensure-a-rest-redirection-is-not-relative/130709/2 "2008-03-02T11:59:51Z")

</div>

Nevermind, after doing a bit more research, I’m pretty sure the cause  
of this is phone and not rails.

Sorry if this next bit is a bit off-topic, just hoping to help anyone  
else who might be tearing hair out over this:

It seems that the stock browser in series 40 phones:

a) Maintains the method of the call on redirect. So, if you redirect  
from a controller which you have POSTed to, then the phone POSTs the  
redirect (joy);

b) Strips protocol and server from redirects, so they all become  
relative.

Also, the complaint about sending data to another server only occurs  
with POSTs (This makes a sense in a twisted way).

I’ve not yet found a sensible work around, but I guess I’ll be  
submitting my forms via GET for these stupid phones in the future.  
Does Microsoft own Nokia?

This isn’t really the right place to ask if anyone has any better  
ideas, but drop me an email if you’ve any suggestions.

Cheers,  
Todd
