Reputation: 1428
I have a tornado web app that would redirect users back to main page ("/" of the app). Then the tornado
web app is deployed using nginx as the one of the app (e.g. www.helloworld.com/app) the redirection no longer works. The table below should describe the situation.
+-----------------------------+---------------------------------+
| Root URL of tornado app | www.helloworld.com/app |
| Redirect URL | www.helloworld.com/app/redirect |
| Expected URL after redirect | www.helloworld.com/app |
| Actual URL after redirect | www.helloworld.com |
+-----------------------------+---------------------------------+
Here is my RedirectHandler
class RedirectHandler(tornado.web.RequestHandler):
def get(self):
self.redirect(self.reverse_url("index"))
And here is my Application
handlers = [
tornado.web.url(r'/', IndexPageHandler, name='index'),
tornado.web.url(r'/redirect', RedirectHandler, name='redirect'),
]
Upvotes: 0
Views: 736
Reputation: 22134
Tornado is not designed for use with proxies that strip off a prefix of the URL. Configure your Tornado servers with full URLs (tornado.web.url(r'/app', IndexPageHandler, name='index')
) and remove the path from your nginx proxy_pass
directive.
Upvotes: 1