I need to ensure that the user who has sent the request is the localhost
… what’s the best way to do this?
Sal Syed wrote:
I need to ensure that the user who has sent the request is the localhost
… what’s the best way to do this?
… i don’t know how to do this via webrick, but u find out the
remote_ip that required the request in the app code simply so:
request.remote_ip
so u could do something like
class SomeController
before_filter :block_localhosts
def action1
end
def action2
end
def block_localhosts
if request.remote_ip=~/127.0.0.1/
return false
end
end
end
in the example above, all requests coming from 127.0.0.1 won’t be
rendered.
hth