Rails / Rack ... Rack :: ReverseProxy, causing the request timeout

I think that I am above my head and cannot understand how to debug or where to go from here ?! Any guidance would be greatly appreciated!

Problem:

  • Development environment: everything works
  • Production: I get a "Request Timeout" error

Purpose:

"www.site.com/blog" display content from "blog.site.com" without a redirect / change URL

Customization

  • www.site.com is a Rails app on Heroku
  • blog.site.com is WordPress on Bluehost

So, I do not have access to the server configuration

An approach

Use rack-reverse-proxy gem as described in How can I use a subdirectory instead of a subdomain? jplewicke

Implementation

Gemfile

gem "rack-reverse-proxy", :require => "rack/reverse_proxy"

config.ru( AppName:: Application)

use Rack::ReverseProxy do
  reverse_proxy(/^\/blog(\/.*)$/,'http://blog.site.com$1',
  opts = {:preserve_host => true})
end

/routes.rb

match "/blog" => redirect("/blog/")

/

, , . , , - , .. www.site.com( , blog.site.com). 5-10 www.site.com , blog.site.com.

2013-03-05 05: 54: 19 + 00: 00 app web.1 - - GET "/resource" 66.108.140.26/cpe-66-108-140-26.nyc.res.rr.com 2013-03-05 05:54:19 +0000

2013-03-05 05: 54: 19 + 00: 00 heroku router - - at = info method = GET path =/blog host = www.site.com fwd = "66.108.140.26/cpe-66-108-140-26.nyc.res.rr.com" dyno = web.1 queue = 0 wait = 0ms connect = 1ms service = 7ms status = 301 bytes = 105

2013-03-05 05: 54: 49 + 00: 00 heroku router - - at = = H12 desc = " " = GET path =/blog/ = www.site.com fwd = "66.108.140.26/cpe-66-108-140-26.nyc.res.rr.com" dyno = web.1 queue = 0ms wait = 0ms connect = 2ms service = 30000ms status = 503 bytes = 0

...

//production.rb

config.consider_all_requests_local = true
config.log_level = :debug

,

... ... .... .

, ,

, ? !

+5
1

4. , :

use Rack::ReverseProxy do
  reverse_proxy_options preserve_host: true
  reverse_proxy '/blog', 'http://grav.somedomain.net/'
end

(301) / .

, / /blog/home !

require 'rack/rewrite'
use Rack::Rewrite do
  rewrite   '/blog',  '/blog/home'
end

, - , : , , -.

!

0

All Articles