Issue
I found this great blog post on how to use Rack::Proxy
as a separate proxy app. The article explains how he uses Rack::Proxy
to proxy requests to http://localhost:3000
to an app on port 3001
and requests to http://localhost:3000/api
to an app on port 3002
. I want to do the same thing, but I do not want to create a separate proxy app. Instead, I want my main Rails app to proxy requests to /blog
to a different app.
Solution
Figured it out.
lib/proxy.rb
require 'rack-proxy'
class Proxy < Rack::Proxy
def initialize(app)
@app = app
end
def rewrite_env(env)
# do magic in here
end
end
config/application.rb
config.middleware.use "Proxy"
Answered By - John Answer Checked By - Mildred Charles (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.