The middleware helps ensure a site domain. Useful when the main domain change and we want to keep links and user attending the new domain.
There are a few settings via environment variables, state bellow.
FLASK_ENV
(required) has to be production otherwise will not apply redirection;SITE_DOMAIN
(required) the principal domain to redirect to;PRODUCTION_DOMAINS
(optional) to list your available domains (comma separated). When supplied will only redirect from those domains. Useful for pre-production domains.