Set custom header for Post requests?

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 :slight_smile:

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.

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

Fred

Of course! Stupid me, forgot about that. Thanks a heap for reminding! :slight_smile: