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.

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

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.

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

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 Yandell