Skip to content

Commit

Permalink
Always use HTTPS protocol when require_https_domain is True
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Aug 28, 2018
1 parent 6fd22b0 commit 5037210
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions readthedocs/core/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5037210

Please sign in to comment.