You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't get a simple app to work with this, ex: I want to proxy /api to github.api
# app.rb
require 'sinatra'
require 'rack/proxy'
class SimpleProxy < Rack::Proxy
def perform_request(env)
request = Rack::Request.new(env)
puts request.path
if request.path =~ %r{/api}
env["HTTP_HOST"] = "https://api.github.com"
env["REQUEST_PATH"] = "/users/octocat"
super(env)
else
@app.call(env)
end
end
end
class MyApp < Sinatra::Application
use SimpleProxy, {ssl_verify_none: true}
get '/sinatra' do
'inside sinatra'
end
end
# config.ru
require_relative 'app'
run Rack::URLMap.new('/' => MyApp)
I can't get a simple app to work with this, ex: I want to proxy
/api
togithub.api
Tried moving the
use SimpleProxy, {ssl_verify_none: true}
to myconfig.ru
but that just resulted in a different error:Not sure what I'm doing wrong, I'm expecting:
Not sure what I'm doing wrong.
The text was updated successfully, but these errors were encountered: