#!/usr/bin/env ruby # This is the AutoResponse rule config file # using ruby syntax # Examples: # if you want to respond all requests with url # equals "http://www.1688.com" with "Hello world!" : url "http://www.1688.com" r "Hello world" # or you can respond with Array url "http://china.alibaba.com" r [200, {}, "Got replaced"] #[status, header, body] # if you want to respond these requests with a file: url "http://www.yousite.com" goto "/home/youruser/somefile.txt" # on Windows: url "http://www.another-site.com" goto "C:/Program\ Files/proj/test.txt" # if you want to respond with another remote url: url "http://www.targetsite.com" goto "http://www.real-request-target.com/test.html" # you can set response headers in the returned string # e.g. url "http://www.target-site.com/target-url" r <<-RESP Test-Msg : http-header-example header-server : Auto-Responder Content-Type : text/html; charset=utf-8

Hello world!

RESP # just respond with status number url "http://www.catchme.com" r 404 # Example of using regexp url %r{http://pnq\.cc} r "Any request made to pnq.cc will be responded with this message." # Regular expression and params url %r{http://anysite\.cc(.*)} do |uri, path| <<-RESP Content-Type : text/html; charset=utf-8 With regular expression, you can do more powerful things.
You're requesting #{path}
Server time is #{Time.now} now. RESP end