location / {
proxy_pass http://127.0.0.1:8082;
}location /luigi/ {
proxy_pass http://127.0.0.1:8082/$1;
Note that, the second line from before is missing.
--
You received this message because you are subscribed to a topic in the Google Groups "Tornado Web Server" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-tornado/FAcEpSBHxZQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/06341ea7-f9f8-40c8-9f90-b18c433eeecdn%40googlegroups.com.
Hi Ben,Thanks for your insightful reply. By this time, I figured the following (from luigi/server.py):300 handlers = [301 (r'/api/(.*)', RPCHandler, {"scheduler": scheduler}),302 (r'/luigi/', RootPathHandler, {'scheduler': scheduler}),303 (r'/tasklist', AllRunHandler, {'scheduler': scheduler}),304 (r'/tasklist/(.*?)', SelectedRunHandler, {'scheduler': scheduler}),305 (r'/history', RecentRunHandler, {'scheduler': scheduler}),306 (r'/history/by_name/(.*?)', ByNameHandler, {'scheduler': scheduler}),307 (r'/history/by_id/(.*?)', ByIdHandler, {'scheduler': scheduler}),308 (r'/history/by_params/(.*?)', ByParamsHandler, {'scheduler': scheduler}),309 (r'/metrics', MetricsHandler, {'scheduler': scheduler})310 ]And then curl -L http://`hostname`/luigi/ works fine.However, keeping line 302 pristine (r'/', RootPathHandler, {'scheduler': scheduler}) and including `static_url_prefix` as follows didn't solve the problem:295 settings = {"static_path": os.path.join(os.path.dirname(__file__), "static"),296 "static_url_prefix":"/luigi/",297 "unescape": tornado.escape.xhtml_unescape,298 "compress_response": True,299 }What do you think about the latter?
Best,
TashrifOn Saturday, August 15, 2020 at 12:13:27 PM UTC-4 Ben Darnell wrote:On Tue, Aug 11, 2020 at 3:18 PM Tashrif <tashri...@gmail.com> wrote:Note that, the second line from before is missing.That's because `/static/visualizer/image.html` no longer matches your location rule, so nginx isn't sending it to Tornado. (it should show up in the nginx logs)Unfortunately, the URL rewriting functionality in nginx that you're using here isn't fully transparent - it won't work if the application behind the rewrites uses absolute links (which most Tornado applications do, thanks at least to the `static_url` template function). I think you have four options:1. Make Luigi add a prefix `/luigi/` to all of its url routes (including `static_url_prefix`), perhaps by adding a new configuration parameter. This is the approach I always take; so my backend applications are always aware of the URL at which they are being served.2. Make Luigi use only relative links (replacing all uses of `static_url`, among other things)3. Use nginx's `sub_filter` feature to rewrite links4. Give up on non-root locations and give each application it's own port or hostname-Ben
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.