Forum: Ruby on Rails Set custom header for Post requests?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Heinz S. (Guest)
on 2009-02-26 14:59
Hello,

I need some kind of an autorization for my *_to_remote functions in my
application. For example one of the *_to_remote function calls
"/pages/welcome" and the page should be updated via page.replace_html or
something like that.
The thing is that I don't want users to see that page when they type
domain.com/pages/welcome into their browser.
My idea was to add a custom header field which is added every time when
my applications sends an *_to_remote request.

Does anyone know how I could do that? Doesn't necessarily need to be
solved by adding a custom header field. Any suggestions are highly
appreciated :)
Frederick C. (Guest)
on 2009-02-26 15:06
(Received via mailing list)
On 26 Feb 2009, at 12:59, Heinz S. wrote:

> My idea was to add a custom header field which is added every time
> when
> my applications sends an *_to_remote request.


There already is one :-) The X-Requested-With header gets set ( and
the xhr? method in your controller will test for that for you)

Fred
Heinz S. (Guest)
on 2009-02-26 15:15
Of course! Stupid me, forgot about that. Thanks a heap for reminding! :)
This topic is locked and can not be replied to.