Skip to content

Instantly share code, notes, and snippets.

@jasonnoble
Created September 4, 2010 04:14
Show Gist options
  • Select an option

  • Save jasonnoble/564898 to your computer and use it in GitHub Desktop.

Select an option

Save jasonnoble/564898 to your computer and use it in GitHub Desktop.
# rackup.ru
require 'faker'
app = proc do |env|
body = "#{Faker::Company.catch_phrase} in order to #{Faker::Company.bs}"
[ 200, {'Content-Type' => 'text/html'}, body ]
end
run app
# rackup rackup.ru
jasonn@ruby-rules:~/sources/weather$ curl http://localhost:9292/b
Right-sized scalable installation in order to architect interactive markets
jasonn@ruby-rules:~/sources/weather$ curl http://localhost:9292/b
Phased modular moratorium in order to engineer next-generation interfaces
jasonn@ruby-rules:~/sources/weather$
# Works good
# rails weather
# config/initializers/reverse_proxy.rb
if %w|cucumber development test|.include? RAILS_ENV
begin
gem "rack-reverse-proxy"
require "rack/reverse_proxy"
ActionController::Dispatcher.middleware.insert 0, Rack::ReverseProxy do
reverse_proxy "/b", "http://127.0.0.1:9292/"
end
rescue LoadError
STDERR.puts <<-END
We are in a dev environment and rack-reverse-proxy was not found.
Please ensure that you are reverse proxying the correct paths or
do a `gem install rack-reverse-proxy` to use the built in config.
END
end
end
# script/server
http://localhost:3000 loads "default" rails app page
http://localhost:3000/b shows a blank page
Output of rackup shows
127.0.0.1 - - [03/Sep/2010 23:10:55] "GET /b HTTP/1.1" 200 - 0.0018
Why isn't the content returned by the rack app showing up?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment