2
我有一個簡單的Sinatra代理,當一個端點被調用時,它將重定向到同一個Sinatra代理上的另一個端點。Sinatra不通過標題與重定向
當我使用頭進行請求時,當請求在第一個端點重定向時,代理似乎不會將此頭傳遞給第二個端點。這是我的代碼:
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
任何提示將不勝感激。
謝謝
謝謝康斯坦丁 - 那正是我一直在尋找的。我清理忘了我可以使用pass方法。乾杯。 – emson 2010-06-07 13:05:36