Skip to content

Instantly share code, notes, and snippets.

@mtodd
Created September 12, 2008 05:10
Show Gist options
  • Save mtodd/10380 to your computer and use it in GitHub Desktop.
Save mtodd/10380 to your computer and use it in GitHub Desktop.
class SubdomainToPathInfo # man I'm bad with names
def initialize(app)
@app = app
end
def call(env)
@app.call(filter(env))
end
def filter(env)
if env['SERVER_NAME'] =~ /(.*)\.domain\.com/
env['PATH_INFO'] = "#{$1}#{env['PATH_INFO']}"
end
env
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment