ruby on rails - How do I proxy AJAX requests with Rack Middleware? -
ruby on rails - How do I proxy AJAX requests with Rack Middleware? -
i'm developing rails application uses api backend ajax requests written sinatra.
the api runs separately rails:
rails: localhost:3000
api: localhost:9393
in production, we'll proxying requests api nginx.
the problem don't have nginx in development mode, we're using thin. need sort of rack middleware can add together in development mode proxy requests me.
can give me illustration of how this?
perhaps rack::proxy:
http://coderack.org/users/cwninja/middlewares/18-rackproxy
use rack::proxy |req| if req.path =~ %r{identify api request regex here} uri.parse("http://localhost:9393/#{req.fullpath}") end end
ruby-on-rails ajax ruby-on-rails-3 sinatra reverse-proxy
Comments
Post a Comment