Skip to content

Instantly share code, notes, and snippets.

@postwait
Created October 18, 2013 05:53
Show Gist options
  • Select an option

  • Save postwait/7037057 to your computer and use it in GitHub Desktop.

Select an option

Save postwait/7037057 to your computer and use it in GitHub Desktop.
module(..., package.seeall)
function config()
ats.config.proxy.config.http.server_ports("8888 8443:ipv4:ssl")
ats.config.proxy.config.url_remap.pristine_host_hdr(0)
end
function config_ssl(add)
add({ dest_ip = "*", ssl_cert_name = "bar.pem", ssl_key_name = "barKey.pem" })
end
function config_remap(r)
ats.log.note("I'm a gonna remap stuff.")
r:definefilter("name", { src_ip = { "192.168.0.0-192.168.255.255", "10.0.0.0-10.255.255.255" }
, method = { "PURGE", "DELETE" }
, action = "allow" })
r:definefilter("name", { src_ip = "0.0.0.0-255.255.255.255"
, method = { "GET", "POST", "PUT", "OPTIONS" }
, action = "allow" })
r:activatefilter("name")
r:map("http://localhost:8888/special/", "http://omniti.com/",
{ src_ip = "127.0.0.1" },
{ plugin = "foo.so", pparams = { "arg1", "arg2" } } )
r:map("http://localhost:8888/", "http://omniti.com/",
{ src_ip = "127.0.0.1" }, { action = "GET" } )
r:deactivatefilter("name")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment