Use PREFERRED_URL_SCHEME in external url_for if scheme is not defined.

If the behaviour expected is to use `PREFERRED_URL_SCHEME` even in request context, it fixes #1129.