Mechanize can be configured to use HTTP proxies. Some network configurations require you to use HTTP proxies to make connections outside the network, and there are various proxies one might want to run on localhost for debugging or inspection purposes.
To configure a proxy, use the Mechanize#set_proxy method. It takes four parameters, the proxy host, port and an optional user and password. In this example, a proxy at localhost on port 10000 is configured in the block passed to Mechanize#new.
agent = Mechanize.new do|a| a.set_proxy('localhost', 10000, 'user', 'pass') a.user_agent_alias = "Windows IE 6" end