I have the following setup:
- Main Server:
 nginx forwarding"https://example.com/machine1/*" -> "http://machine1/*"
- Machine1:
 ngnix + uwsgi + flask mounting at/, e.g./foobar.
That means, https://example.com/machine1/foobar will hit the Machine1 as /foobar.
I have the mounting point /machine1 in an variable, NGINX_MOUNT_URL.
Problem is, the url_for does not resolves that.
I tried
app.config["APPLICATION_ROOT"] = NGINX_MOUNT_URL   # = "/machine1"
but it seems that only applies to cookie urls.
Have a simple view:
@app.route("/foobar")
def web_foobar():
    from flask import url_for
    return "The URL for this page is {}".format(url_for("web_foobar"))
# end def
So, browsing https://example.com/machine1/foobar (Main Server) will get proxied to http://machine1/foobar (Machine1) which displays The URL for this page is /foobar.
I need it to be /machine1/foobar, for linking in templates to work.
I tried the offered solutions in https://stackoverflow.com/a/18967744/3423324, but it always ended up that I had to browse https://example.com/machine1/machine1/foobar to even get the page /foobar.
How to make flask.url_for aware of APPLICATION_ROOT?
 
     
    