diff --git a/stream.py b/stream.py index fef1d97..07ce605 100755 --- a/stream.py +++ b/stream.py @@ -315,7 +315,8 @@ class MainHandler(tornado.web.RequestHandler): self.set_status(404) self.write("Stream not found. (invalid upstream)") else: - ctype = await handler.proxy.content_type(upstream) + upstream_proxy = await handler.proxy.proxy_url(upstream, None) + ctype = await handler.proxy.content_type(upstream_proxy) logger.info(ctype) logger.info(upstream) data = None @@ -326,8 +327,7 @@ class MainHandler(tornado.web.RequestHandler): else: self.set_header("Content-Type", ctype) if redir: - upstream = await handler.proxy.proxy_url(upstream, None) - self.redirect(upstream, status=303) + self.redirect(upstream_proxy, status=303) async def get(self): await self.handle_any(True) async def head(self):