エンドポイントが呼び出されると、同じ Sinatra プロキシ上の別のエンドポイントにリダイレクトするシンプルな Sinatra プロキシがあります。
ヘッダーを使用してリクエストを行うと、リクエストが最初のエンドポイントでリダイレクトされるときに、プロキシがこのヘッダーを 2 番目のエンドポイントに渡さないようです。これは私のコードです:
get '/first' do
# get the header from the request
username = env['HTTP_USERNAME']
# set the header for the response
response['username'] = username
redirect '/second'
end
get '/second' do
# This doesn't exist when redirected from /first
puts env['HTTP_USERNAME']
# Here is a list of all headers
env.each_key do |key|
puts "KEY: #{key} VALUE: #{env[key]}" unless key.nil?
end
"DONE"
end
どんなヒントでも大歓迎です。
ありがとう