fix redirection when behind a proxy

if we are behind a proxy, flask should send redirections to the
proxy address, not its own.
add the variable EXTERNAL_HOST that is a string of scheme, host,
and port to describe the correct endpoint.
e.g. https://host.org or http://host2.org:8080

if the variable is not set, flask sends out relative url redirects