     console.log "#{prefix}: INVALID API_KEY."
     return false
 
-check_request = (req) ->
+check_request = (req, res) ->
   unless check_api_key req
     unless check_ip req
-      res.writeHead 200, {'Content-Type': 'text/plain'}
-      res.end 'Not allowed to access.'
-
+      return false
 
 module.exports = (robot) ->
 


  if req.headers['X-Forwarded-For']
    remote_ip = req.headers['X-Forwarded-For']

  deny_ips  = deny.split(',')
  allow_ips = allow.split(',')

  message = ''

  robot.router.get "#{path}", (req, res) ->
    if check_request(req, res) is false
      res.writeHead 200, {'Content-Type': 'text/plain'}
      res.end 'Not allowed to access.'
      return

    query   = querystring.parse(req._parsedUrl.query)
    room    = query.room
