Skip to content

Commit 96fe669

Browse files
authored
Canonical redirects: check if the project supports custom domains (#10098)
In .com need to check for this. But we don't allow users to create custom domains if they don't have the right subscription, so not sure if this is really needed.. It can be useful only if a user downgrades their subscription I guess.
1 parent 776260a commit 96fe669

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

readthedocs/proxito/views/serve.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from readthedocs.builds.constants import EXTERNAL, INTERNAL, LATEST, STABLE
1515
from readthedocs.builds.models import Version
1616
from readthedocs.core.mixins import CDNCacheControlMixin
17-
from readthedocs.core.resolver import resolve_path
17+
from readthedocs.core.resolver import resolve_path, resolver
1818
from readthedocs.core.unresolver import (
1919
InvalidExternalVersionError,
2020
InvalidPathForVersionedProjectError,
@@ -281,7 +281,8 @@ def _get_canonical_redirect_type(self, request):
281281
.filter(canonical=True, https=True)
282282
.exists()
283283
)
284-
if canonical_domain:
284+
# For .com we need to check if the project supports custom domains.
285+
if canonical_domain and resolver._use_cname(project):
285286
log.debug(
286287
"Proxito Public Domain -> Canonical Domain Redirect.",
287288
project_slug=project.slug,

0 commit comments

Comments
 (0)