How to get url_path from "http://my.subdomain.com" to "https:my.subdomain.com" using target_url = url_path(request.args.get('url')

14 Views Asked by At

I´m using docker compose to run QWC-Docker with microservices: https://github.com/qwc-services/qwc-docker.

I have a server already running in a VPS, but i´m having issues with the authentication url path. I have Nginx Proxy Manager to reverse proxy and handle SSL Let´s Encrypt certificate.

So when I try to access my.subdomain.com/qwc_admin it redirects to my.subdomain.com/auth/login?url=http://my.subdomain.com/qwc_admin/

I need it to get the url with the "HTTPS"...

def login(self):
    """Authorize user and sign in."""
    target_url = url_path(request.args.get('url') or self.tenant_base())
    retry_target_url = url_path(request.args.get('url') or None)
    self.logger.debug("Login with target_url `%s`" % target_url)

    if POST_PARAM_LOGIN:
        # Pass additional parameter specified
        req = request.form
        queryvals = {}
        for key, val in req.items():
            if key not in (self.USERNAME, self.PASSWORD):
                queryvals[key] = val
        parts = urlparse(target_url)
        target_query = dict(parse_qsl(parts.query))
        target_query.update(queryvals)
        parts = parts._replace(query=urlencode(target_query))
        target_url = urlunparse(parts) or None

    self.clear_verify_session()

This is the link to the source code text

I´m quite new to either Python3 and Docker so I´m kinda lost...

0

There are 0 best solutions below