There's probably a builtin way to do this, rack or CGI or sometihng.