Method: MiddleSquid::Actions#replace_by

Defined in:
lib/middle_squid/actions.rb

#replace_by(url) ⇒ Object

Serve another page in place of the requested one. Avoid in favor of #redirect_to when possible.

Examples:

Block Google advertisements

run lambda {|uri, extras|
  redirect_to 'http://webserver.lan/blocked.html' if uri.host == 'ads.google.com'
}

Parameters:

  • url (String)

    the substitute url



36
37
38
# File 'lib/middle_squid/actions.rb', line 36

def replace_by(url)
  action :replace, url: url
end