Created
June 21, 2010 23:27
-
-
Save russ/447693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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