Local request

Hi everybody!

Does anyone know the best approach to create local-only path?

====code begin====

MyApp::Application.routes.draw do
match ‘quicksearch’ => ‘application#quicksearch’
end

===code end===

I want the path ‘\quicksearch’ to be exactly local (available from
application itself only), any external requests must be ignored.

The first thing came into my mind is to create small request filter
based on IP (?). Of course…
Filter can be route-level or middleware-level, but anywhere… IP address
as a base of distinction seems to me not so good.

Any opinions, folks?

On Tue, Jul 24, 2012 at 10:49 AM, Valery K. [email protected] wrote:

I want the path ‘\quicksearch’ to be exactly local (available from application
itself only), any external requests must be ignored.

Then why even bother to access it through a controller?


Hassan S. ------------------------ [email protected]

twitter: @hassan

If the javascript runtime could do it :slight_smile:

On Tue, Jul 24, 2012 at 12:09 PM, Valery K. [email protected] wrote:

If the javascript runtime could do it :slight_smile:

JavaScript? Is this executing on the client or on the server?


Hassan S. ------------------------ [email protected]

twitter: @hassan

Oops, I just realized that javascript code executing always on client’s
browser, and any request will have ‘REMOTE_ADDR’ = client’s IP. Thus,
there is only approach to use some kind of authenticity_token.

I’ve never done something like this before (routing to application
controller), but weeks ago I saw this project in this mail list

and in its routes file he made something like you mentioned.
Maybe you can use it as an example.

Javier Q.