diff --git a/readthedocs/core/resolver.py b/readthedocs/core/resolver.py index abe1d5d9671..46ebff2d16a 100644 --- a/readthedocs/core/resolver.py +++ b/readthedocs/core/resolver.py @@ -161,10 +161,13 @@ def resolve(self, project, require_https_domain=False, filename='', private=None domain = getattr(settings, 'PRODUCTION_DOMAIN') protocol = 'http' - if custom_domain: - # Rely on the ``Domain.https`` field or force it if specified - if custom_domain.https or require_https_domain: - protocol = 'https' + # Rely on the ``Domain.https`` field or force it if specified + use_https_protocol = any([ + (custom_domain and custom_domain.https), + require_https_domain, + ]) + if use_https_protocol: + protocol = 'https' else: # Use HTTPS if settings specify public_domain = getattr(settings, 'PUBLIC_DOMAIN', None)