With Rails 3 routes, how do you only allow a requests from 127.0.0.1? -


I am writing an app where many routes should reach from the local host. It seems that this is possible with the new routing system.

Here are examples of setting an IP address blacklist for binding routes based on IP address and for your routes, but I am interested in whitelisting with only one IP address is.

It would be nice if something like this works:

  get "/ posts" = & gt; "Post #Show",: Barriers = & gt; {: Ip = & gt; '127.0.0.1'}  

But that did not happen. Am I missing the right syntax right now?

You can do this

  "/ post" = & Gt; Receive "Post #Show",: Obstacles = & gt; {: Ip = & gt; /127.0.0.1/}  

or

  Obstacles (= ip = & gt; 127.0.0.1/) Get "/ posts" = & Gt; "Post # Show" and  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -