<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: webrick code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 08:17:47 GMT</pubDate>
    <description>DZone Snippets: webrick code</description>
    <item>
      <title>Basic WEBrick setup for local web server</title>
      <link>http://snippets.dzone.com/posts/show/5659</link>
      <description>Put the following functions and aliases into your ~/.bash_login (or alternatives).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;unset -f webrick_local&lt;br /&gt;&lt;br /&gt;function webrick_local() { &lt;br /&gt;&lt;br /&gt;   declare root_dir="${HOME}/Desktop/www"&lt;br /&gt;&lt;br /&gt;   /bin/mkdir -p "${root_dir}/WEBrickLog"&lt;br /&gt;   /bin/chmod 0754 "${root_dir}" "${root_dir}/WEBrickLog"&lt;br /&gt;&lt;br /&gt;   /usr/bin/touch "${root_dir}/WEBrickLog/webrick.pid" "${root_dir}/WEBrickLog/webrick_ruby.pid"&lt;br /&gt;   /bin/chmod 0644 "${root_dir}/WEBrickLog/webrick.pid" "${root_dir}/WEBrickLog/webrick_ruby.pid"&lt;br /&gt;&lt;br /&gt;#   /usr/bin/touch "${root_dir}/index.html"&lt;br /&gt;#   /bin/chmod 0754 "${root_dir}/index.html"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/usr/local/bin/ruby &lt;&lt;-HEREDOC&lt;br /&gt;&lt;br /&gt;   require 'webrick'&lt;br /&gt;   require 'webrick/accesslog'&lt;br /&gt;   include WEBrick&lt;br /&gt;&lt;br /&gt;   require 'thread'&lt;br /&gt;   require 'pp'&lt;br /&gt;&lt;br /&gt;   root_dir = "${root_dir}"&lt;br /&gt;   http_dir = File.expand_path(root_dir)&lt;br /&gt;&lt;br /&gt;   File.open(http_dir + "/WEBrickLog/webrick_ruby.pid", "w") do |f|&lt;br /&gt;      f.puts(Process.pid)&lt;br /&gt;   end&lt;br /&gt;&lt;br /&gt;   # cf. http://microjet.ath.cx/webrickguide/html/Logging.html&lt;br /&gt;   webrick_log_file = File.expand_path(http_dir + "/WEBrickLog/webrick.log")&lt;br /&gt;   #webrick_log_file = '/dev/null'  # disable logging&lt;br /&gt;   webrick_logger = WEBrick::Log.new(webrick_log_file, WEBrick::Log::DEBUG)&lt;br /&gt;&lt;br /&gt;   access_log_stream = webrick_logger&lt;br /&gt;   access_log = [[ access_log_stream, WEBrick::AccessLog::COMBINED_LOG_FORMAT ]]&lt;br /&gt;&lt;br /&gt;   system_mime_table = WEBrick::HTTPUtils::load_mime_types('/private/etc/httpd/mime.types.default')&lt;br /&gt;   system_mime_table.store('rhtml', 'text/html')   # add a mime type for .rhtml files&lt;br /&gt;   system_mime_table.store('php', 'text/html')&lt;br /&gt;   system_mime_table.store('rb', 'text/plain')&lt;br /&gt;   system_mime_table.store('pid', 'text/plain')&lt;br /&gt;   #pp system_mime_table.sort_by { |k,v| k }&lt;br /&gt;&lt;br /&gt;   server = WEBrick::HTTPServer.new(&lt;br /&gt;     :BindAddress     =&gt;    "localhost",&lt;br /&gt;     :Port            =&gt;    9090,&lt;br /&gt;     :DocumentRoot    =&gt;    http_dir,&lt;br /&gt;     :FancyIndexing   =&gt;    true,&lt;br /&gt;     :MimeTypes       =&gt;    system_mime_table,&lt;br /&gt;     :Logger          =&gt;    webrick_logger,&lt;br /&gt;     :AccessLog       =&gt;    access_log&lt;br /&gt;   )&lt;br /&gt;&lt;br /&gt;   server.config.store(:DirectoryIndex, server.config[:DirectoryIndex] &lt;&lt; "default.htm")&lt;br /&gt;   #pp server.config&lt;br /&gt;&lt;br /&gt;   # cf. http://snippets.dzone.com/posts/show/5208&lt;br /&gt;   class TimeServlet &lt; HTTPServlet::AbstractServlet&lt;br /&gt;&lt;br /&gt;      def do_GET(req, res)&lt;br /&gt;         res['Content-Type'] = 'text/html'&lt;br /&gt;         res.status = 200&lt;br /&gt;         res.body = "&lt;html&gt;Time: #{Time.now.to_s}&lt;/html&gt;" + "\n"&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;      # cf. http://www.hiveminds.co.uk/node/244, published under the&lt;br /&gt;      # GNU Free Documentation License, http://www.gnu.org/copyleft/fdl.html&lt;br /&gt;&lt;br /&gt;      @@instance = nil&lt;br /&gt;      @@instance_creation_mutex = Mutex.new&lt;br /&gt;&lt;br /&gt;      def self.get_instance(config, *options)&lt;br /&gt;         #pp @@instance&lt;br /&gt;         @@instance_creation_mutex.synchronize { &lt;br /&gt;            @@instance = @@instance || self.new(config, *options) }&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;   end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   # cf. http://ttripp.blogspot.com/2007/01/fun-with-http.html&lt;br /&gt;   class PostDumper &lt; WEBrick::HTTPServlet::AbstractServlet&lt;br /&gt;  &lt;br /&gt;      # Reload file for each request, instantly&lt;br /&gt;      # updating the server with code changes &lt;br /&gt;      # without needing a restart.&lt;br /&gt;&lt;br /&gt;=begin&lt;br /&gt;      def PostDumper.get_instance( config, *options )&lt;br /&gt;         load __FILE__&lt;br /&gt;         PostDumper.new config, *options&lt;br /&gt;      end&lt;br /&gt;=end&lt;br /&gt;&lt;br /&gt;      # cf. http://www.hiveminds.co.uk/node/244, published under the&lt;br /&gt;      # GNU Free Documentation License, http://www.gnu.org/copyleft/fdl.html&lt;br /&gt;&lt;br /&gt;      @@instance = nil&lt;br /&gt;      @@instance_creation_mutex = Mutex.new&lt;br /&gt;&lt;br /&gt;      def self.get_instance(config, *options)&lt;br /&gt;         #pp @@instance&lt;br /&gt;         @@instance_creation_mutex.synchronize { &lt;br /&gt;            @@instance = @@instance || self.new(config, *options) }&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;      def do_GET( request, response )&lt;br /&gt;         response.status = 200&lt;br /&gt;         response['Content-Type'] = "text/plain"&lt;br /&gt;         response.body = dump_request( request )&lt;br /&gt;      end&lt;br /&gt;  &lt;br /&gt;      def do_POST( request, response )&lt;br /&gt;         response.status = 200&lt;br /&gt;         response['Content-Type'] = "text/plain"&lt;br /&gt;         response.body = dump_request( request )&lt;br /&gt;         response.body &lt;&lt; request.body&lt;br /&gt;      end&lt;br /&gt;  &lt;br /&gt;      def dump_request( request )&lt;br /&gt;         request.request_line &lt;&lt; "\r\n" &lt;&lt;&lt;br /&gt;         request.raw_header.join( "" ) &lt;&lt; "\r\n"&lt;br /&gt;      end&lt;br /&gt;   end&lt;br /&gt;&lt;br /&gt;   server.mount("/dump", PostDumper)&lt;br /&gt;   server.mount("/time", TimeServlet, {:FancyIndexing=&gt;true})&lt;br /&gt;&lt;br /&gt;   # handle signals&lt;br /&gt;   %w(INT).each do |signal|&lt;br /&gt;      trap(signal) { server.shutdown }&lt;br /&gt;   end&lt;br /&gt;&lt;br /&gt;   server.start&lt;br /&gt;&lt;br /&gt;HEREDOC&lt;br /&gt;&lt;br /&gt;return 0&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;export -f webrick_local&lt;br /&gt;&lt;br /&gt;# start WEBrick alias&lt;br /&gt;alias webrick='swr'&lt;br /&gt;&lt;br /&gt;# start WEBrick&lt;br /&gt;unset -f swr&lt;br /&gt;function swr() {   &lt;br /&gt;  declare webrick_pid_file="${HOME}/Desktop/www/WEBrickLog/webrick.pid"&lt;br /&gt;  if [[ -e "${webrick_pid_file}" ]]; then echo "WEBrick already started!"; return 1; fi&lt;br /&gt;  /bin/bash -c "webrick_local" &amp;&lt;br /&gt;  declare WEBRICKPID=$!&lt;br /&gt;  mkdir -p "${HOME}/Desktop/www/WEBrickLog"&lt;br /&gt;  echo $WEBRICKPID &gt; "${HOME}/Desktop/www/WEBrickLog/webrick.pid"&lt;br /&gt;  return 0&lt;br /&gt;}&lt;br /&gt;export -f swr&lt;br /&gt;&lt;br /&gt;# quit WEBrick&lt;br /&gt;unset -f qwr&lt;br /&gt;function qwr() { &lt;br /&gt;   declare webrick_pid_file="${HOME}/Desktop/www/WEBrickLog/webrick.pid"&lt;br /&gt;   declare webrick_ruby_pid_file="${HOME}/Desktop/www/WEBrickLog/webrick_ruby.pid"&lt;br /&gt;   if [[ ! -e "${webrick_pid_file}" ]]; then echo "no such file: ${webrick_pid_file}"; return 1; fi&lt;br /&gt;   declare PIDW=$(cat "${webrick_pid_file}" 2&gt;/dev/null)&lt;br /&gt;   declare PIDR=$(cat "${webrick_ruby_pid_file}" 2&gt;/dev/null)&lt;br /&gt;   kill -INT $PIDW 2&gt;/dev/null || echo "no such PIDW: ${PIDW}"&lt;br /&gt;   kill -INT $PIDR 2&gt;/dev/null || echo "no such PIDR: ${PIDR}"&lt;br /&gt;   rm -f "${webrick_pid_file}" "${webrick_ruby_pid_file}"&lt;br /&gt;   return 0&lt;br /&gt;}&lt;br /&gt;export -f qwr&lt;br /&gt;&lt;br /&gt;# quit WEBrick; cf. Job Control Commands, http://tldp.org/LDP/abs/html/x8816.html&lt;br /&gt;###alias qwr='echo "quit WEBrick with ctrl-c ..."; fg %webrick 2&gt;/dev/null'&lt;br /&gt;&lt;br /&gt;alias openwww='/usr/bin/open http://localhost:9090'&lt;br /&gt;alias wrlog='/usr/bin/open http://localhost:9090/WEBrickLog/webrick.log'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#----------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;source ~/.bash_login&lt;br /&gt;&lt;br /&gt;webrick&lt;br /&gt;&lt;br /&gt;openwww&lt;br /&gt;wrlog&lt;br /&gt;open http://localhost:9090 &lt;br /&gt;open http://localhost:9090/WEBrickLog&lt;br /&gt;open http://localhost:9090/WEBrickLog/webrick.log&lt;br /&gt;&lt;br /&gt;open http://localhost:9090/time&lt;br /&gt;open http://localhost:9090/dump&lt;br /&gt;&lt;br /&gt;wrlog&lt;br /&gt;qwr&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Further information:&lt;br /&gt;&lt;br /&gt;- &lt;a href="http://www.webrick.org"&gt;WEBrick&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.ruby-doc.org/stdlib/libdoc/webrick/rdoc/index.html"&gt;WEBrick RDoc&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.hiveminds.co.uk/node/245"&gt;What is WEBrick?&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.hiveminds.co.uk/node/244"&gt;Guide to using WEBrick for Rails development&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/"&gt;Dynamic WEBrick Servers in Ruby&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://microjet.ath.cx/WebWiki/WEBrick.html"&gt;Gnome's Guide to WEBrick&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://codeidol.com/other/rubyckbk/Internet-Services/Running-Servlets-with-WEBrick/"&gt;Running Servlets with WEBrick&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://ruby.jamisbuck.org/rsphandler.rb"&gt;rsphandler&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://eigenclass.org/hiki/webrick-rewrite-rules"&gt;URL rewriting with WEBrick&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 17 Jun 2008 17:27:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5659</guid>
      <author>ntk ()</author>
    </item>
    <item>
      <title>Ruby Servlets</title>
      <link>http://snippets.dzone.com/posts/show/5208</link>
      <description>This WEBrick example demonstrates a basic servlet which displays the current time. Source code copied from &lt;a href="http://www.linuxjournal.com/article/8356"&gt;At the Forge - Getting Started with Ruby&lt;/a&gt; [linuxjournal.com].&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/sw/bin/ruby&lt;br /&gt;require 'webrick'&lt;br /&gt;include WEBrick&lt;br /&gt;&lt;br /&gt;# ---------------------------------------------&lt;br /&gt;# Define a new class&lt;br /&gt;class CurrentTimeServlet&lt;br /&gt;  &lt; WEBrick::HTTPServlet::AbstractServlet&lt;br /&gt;&lt;br /&gt;  def do_GET(request, response)&lt;br /&gt;    response['Content-Type'] = 'text/plain'&lt;br /&gt;    response.status = 200&lt;br /&gt;    response.body = Time.now.to_s + "\n"&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# ----------------------------------------------&lt;br /&gt;# Create an HTTP server&lt;br /&gt;s = HTTPServer.new(&lt;br /&gt;  :Port            =&gt; 8000,&lt;br /&gt;  :DocumentRoot    =&gt; "/usr/local/apache/htdocs/"&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;s.mount("/time", CurrentTimeServlet)&lt;br /&gt;&lt;br /&gt;# When the server gets a control-C, kill it&lt;br /&gt;trap("INT"){ s.shutdown }&lt;br /&gt;&lt;br /&gt;# Start the server&lt;br /&gt;s.start&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;e.g. http://localhost:8001/time&lt;br /&gt;output&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Mon Mar 10 23:06:58 +0000 2008&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Reference: http://www.webrick.org/</description>
      <pubDate>Mon, 10 Mar 2008 23:17:53 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5208</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Runt.rb</title>
      <link>http://snippets.dzone.com/posts/show/5009</link>
      <description>// A tiny Ruby web server.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env ruby&lt;br /&gt;&lt;br /&gt;require "webrick"&lt;br /&gt;&lt;br /&gt;s=WEBrick::HTTPServer.new(&lt;br /&gt;        :BindAddress =&gt; "localhost",&lt;br /&gt;        :Port =&gt; 8080,&lt;br /&gt;        :DocumentRoot =&gt; File.dirname($0)+"/"+"www/"&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;trap("INT") { s.shutdown }&lt;br /&gt;&lt;br /&gt;s.start&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 19 Jan 2008 06:46:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5009</guid>
      <author>mcandre (Andrew Pennebaker)</author>
    </item>
    <item>
      <title>WEBrick servlet with HTTP authentication</title>
      <link>http://snippets.dzone.com/posts/show/3830</link>
      <description>// HTTP authentication for a directory listing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'webrick'&lt;br /&gt;include WEBrick&lt;br /&gt;&lt;br /&gt;dir = Dir::pwd&lt;br /&gt;port = 1234&lt;br /&gt;&lt;br /&gt;authenticate = Proc.new do |req, res|&lt;br /&gt;  HTTPAuth.basic_auth(req, res, '') do |user, password|&lt;br /&gt;    user == 'foo' &amp;&amp; password == 'bar'&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;s = HTTPServer.new(:Port =&gt; port, :ServerType =&gt; Daemon)&lt;br /&gt;s.mount('/', HTTPServlet::FileHandler, dir,&lt;br /&gt;  :FancyIndexing =&gt; true,&lt;br /&gt;  :HandlerCallback =&gt; authenticate # Hook up the authentication proc.&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;trap('INT') { s.shutdown }&lt;br /&gt;s.start&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:12:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3830</guid>
      <author>chuyeow (Chu Yeow)</author>
    </item>
    <item>
      <title>WEBrick servlet skeleton</title>
      <link>http://snippets.dzone.com/posts/show/3829</link>
      <description>// Skeleton code for a WEBrick servlet.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'webrick'&lt;br /&gt;include WEBrick&lt;br /&gt;class UberServlet &lt; HTTPServlet::AbstractServlet&lt;br /&gt;&lt;br /&gt;  def do_GET(req, res)&lt;br /&gt;    id = req.query['id'] # Get GET/POST params like that.&lt;br /&gt;    res['content-type'] = 'text/html'&lt;br /&gt;    res.status = 200&lt;br /&gt;    res.body = some_text&lt;br /&gt;  end&lt;br /&gt;  alias :do_POST :do_GET&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# "Mount" the servlet.&lt;br /&gt;server = HTTPServer.new(:Port =&gt; 1234)&lt;br /&gt;server.mount('/some/path', UberServlet)&lt;br /&gt;&lt;br /&gt;# Handle signals.&lt;br /&gt;%w(INT TERM).each do |signal|&lt;br /&gt;  trap(signal) { server.shutdown }&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;server.start&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:08:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3829</guid>
      <author>chuyeow (Chu Yeow)</author>
    </item>
    <item>
      <title>Stop WeBRICK Server in RadRails (if IDE doesn't)</title>
      <link>http://snippets.dzone.com/posts/show/1924</link>
      <description>From: http://lists.radrails.org/pipermail/radrails/2006-February/000313.html&lt;br /&gt;Just hit Restart and it will actually be started. Then you can stop it. If&lt;br /&gt;all else fails, delete the file&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;workspace/.metadata/.plugins/org.radrails.server.core/.servers.&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 17 Apr 2006 09:42:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1924</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>Mongrel on Win32 as Service</title>
      <link>http://snippets.dzone.com/posts/show/1846</link>
      <description>Mongrel now has support for running as a Win32 service right out of the box. The support is still rough but works well enough that we decided to release it. You can thank Luis Lavena for working on this and making it so nice.&lt;br /&gt;&lt;br /&gt;After you do the gem install, find a Rails application you want to run and do:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ mongrel_rails_service install -n myapp -r c:\my\path\to\myapp -p 4000 -e production&lt;br /&gt;$ mongrel_rails_service start -n myapp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now hit the port and poof, works. Stopping the app is just done with:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ mongrel_rails_service stop -n myapp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And, you can even set the CPU processor affinity for the service when yourun the install command. Can&#8217;t even do that on POSIX yet. Now that&#8217;s hot.&lt;br /&gt;&lt;br /&gt;If you run into an app that&#8217;s not running right, my suggestion is to run it with the regular mongrel_rails runner:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ cd c:\my\path\to\myapp&lt;br /&gt;$ mongrel_rails start -p 4500&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Since that will spit out error messages and stuff to the console. Use CTRL-Pause/Break to stop.&lt;br /&gt;</description>
      <pubDate>Wed, 05 Apr 2006 09:44:32 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1846</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>Ruby WEBrick as WebDAV Server</title>
      <link>http://snippets.dzone.com/posts/show/1686</link>
      <description>From: http://sg.validcode.at/articles/2006/02/25/vision-everywhere&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;gem install webrick-webdav&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you have done this dowload webdav.rb.txt rename it to webdav.rb put it into the Vision folder and start it with&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ruby PATH/TO/VISION/webdav.rb&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Sun, 12 Mar 2006 07:26:27 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1686</guid>
      <author>MattScilipoti (Matt Scilipoti)</author>
    </item>
    <item>
      <title>Apache2 proxy to local port</title>
      <link>http://snippets.dzone.com/posts/show/1318</link>
      <description>Apache as the receptionist, forwarding requests to and from an internal server (e.g. webrick or lighttpd).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;VirtualHost *&gt;&lt;br /&gt;        ServerName www.example.com&lt;br /&gt;        ProxyPass / http://localhost:3000/&lt;br /&gt;        ProxyPassReverse / http://localhost:3000/&lt;br /&gt;        ProxyPreserveHost On&lt;br /&gt;&lt;/VirtualHost&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Change 3000 to whatever port you need and make sure the internal server is set up to answer requests on that port (not port 80). The ProxyPreserveHost line is critical to keep all your URLs working correctly.</description>
      <pubDate>Tue, 31 Jan 2006 11:09:16 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1318</guid>
      <author>brainpipe ()</author>
    </item>
    <item>
      <title>How to fix a leaky WEBrick</title>
      <link>http://snippets.dzone.com/posts/show/227</link>
      <description>If WEBrick is leaking out of control, which it does do all the time, shut it down and restart it. &lt;br /&gt;&lt;code&gt;Ctrl-c + Up + Enter&lt;/code&gt;&lt;br /&gt;WEBrick can slow your computer down to a crawl so it is reccomended that you only use it when it's needed. Otherwise just runs tests, WEBrick's leaks are just another great reason to adapt to test driven development.</description>
      <pubDate>Mon, 25 Apr 2005 05:53:18 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/227</guid>
      <author>caseygollan (Casey Gollan)</author>
    </item>
  </channel>
</rss>
