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