I'm trying to rewrite:
mysite.com/blog to blog.mysite.com
To be clear: I only want the user to see mysite.com/blog .Where the blog is actually a separately hosted wordpress site at blog.mysite.com. And mysite.com is a Rails app.
I have attempted to use rack-rewrite to achieve this and I can make it work with a 301 redirect, but not with a rewrite.
config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
#r301 '/blog', 'http://blog.mysite.com' #works
rewrite '/blog', 'http://blog.mysite.com' #fails
end
The reason I am trying to do this in Rails and not in the webserver is because I am using Heroku for hosting and I believe it is not possible to configure this type of rewrite on Heroku.
So my question is simply, how can I achieve this rewrite?
p.s. I saw another post suggesting the use of rack-reverse-proxy but this gem seems quite old and doesn't seem to have had much development. Which makes me nervous of using it.