Fix host in redirect

This commit is contained in:
Omar Roth 2019-03-27 15:25:08 -05:00
parent 61769c6f9c
commit eee973fe86

View file

@ -4240,10 +4240,11 @@ get "/videoplayback" do |env|
if response.headers["Location"]? if response.headers["Location"]?
url = URI.parse(response.headers["Location"]) url = URI.parse(response.headers["Location"])
host = url.host
env.response.headers["Access-Control-Allow-Origin"] = "*" env.response.headers["Access-Control-Allow-Origin"] = "*"
url = url.full_path url = url.full_path
url += "&host=#{host.lchop("https://")}" url += "&host=#{host}"
if region if region
url += "&region=#{region}" url += "&region=#{region}"
@ -4267,10 +4268,11 @@ get "/videoplayback" do |env|
if response.headers["Location"]? if response.headers["Location"]?
url = URI.parse(response.headers["Location"]) url = URI.parse(response.headers["Location"])
host = url.host
env.response.headers["Access-Control-Allow-Origin"] = "*" env.response.headers["Access-Control-Allow-Origin"] = "*"
url = url.full_path url = url.full_path
url += "&host=#{host.lchop("https://")}" url += "&host=#{host}"
if region if region
url += "&region=#{region}" url += "&region=#{region}"