Skip to content

Instantly share code, notes, and snippets.

@russ
Created June 21, 2010 23:27
Show Gist options
  • Save russ/447693 to your computer and use it in GitHub Desktop.
Save russ/447693 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '..', 'lib', 'sheen')
Sheen::Url.destroy_all
class Server < EventMachine::Connection
include Sheen::Server
def backends
[{ :host => 'www.apple.com', :port => 80 }]
end
def receive
if @request.uri =~ '/admin'
pass
end
end
def fetch
@response.headers.delete('Set-Cookie')
end
def deliver
@response.headers['Cache-Control'] = 'private, max-age=0, must-revalidate'
@response.headers['Pragma'] = 'no-cache'
@response.headers['X-Cache'] = (@hit) ? 'HIT' : 'MISS'
end
end
EventMachine::run do
EventMachine::start_server('0.0.0.0', 6789, Sheen::Admin)
EventMachine::start_server('0.0.0.0', 9876, Server)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment