Redirect_to not the same as clicking a link?

I have a simple Rails app and to avoid another login name for users to
remember I’m pulling information off our IT run IIS webserver via
ColdFusion.

I have a simple ColdFusion page called “getLogin.cfm” and it gets the
username of the computer visiting the page. So here’s my flow.

My rails app links to -> getLogin.cfm gets the username and immediately
redirects back to the referring page with the username as a parameter

However, if I do a redirect_to “getLogin.cfm”, the referring URL that
getLogin.cfm see’s is not my Rails app. But if I do a link_to “Get
Login”, “getLogin.cfm” then the user is forwarded over to getLogin.cfm
and redirected back to my Rails app in an instant.

I would like to get this situated so the user doesn’t have to click a
link in order to login.

Is there a way to emulate that click in any way?

My controller code (very simple):
def index
if params[:id].blank?
(the link to getLogin.cfm is in my view)
else
redirect_to :action => ‘show’, :id=>params[:id]
end
end

Any thoughts?

Thanks!

On 10/15/07, Matthew W. [email protected] wrote:

I have a simple Rails app and to avoid another login name for users to
remember I’m pulling information off our IT run IIS webserver via
ColdFusion.

I have a simple ColdFusion page called “getLogin.cfm” and it gets the
username of the computer visiting the page. So here’s my flow.

(I assume the .cfm sets a cookie or something; otherwise how does your
Rails app know they are logged in?)

link in order to login.
Best bet would be to change the getLogin.cfm so you can pass the page
to return to as a parameter. Then pass that with your redirect. The
referer is set by the client (browser), so you don’t have control over
it.

The referer is set by the client (browser), so you don’t have control over it.

you might try setting the HTTP_REFERER header yourself before
redirecting

err… if you’re doing a server side redirect, as in redirect_to, then
you can set headers. in this case the server is the client for the
target URL. at least you could in previous versions, i haven’t tested
in current rails:

headers[“HTTP_REFERER”] = “http://old.url
redirect_to “http://www.new-url.com/

jemminger wrote:

The referer is set by the client (browser), so you don’t have control over it.

you might try setting the HTTP_REFERER header yourself before
redirecting

Errr…no. The HTTP_REFERER header is sent by the browser to the server.
Setting it on the server is meaningless.

As Bob said, you need to pass the URL of the page to return to as a
parameter to your ColdFusion request.

Pete Y.
http://notahat.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs