Skip to content

Commit

Permalink
Canonical redirects: check if the project supports custom domains (#1…
Browse files Browse the repository at this point in the history
…0098)

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.
  • Loading branch information
stsewd authored Mar 6, 2023
1 parent 776260a commit 96fe669
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions readthedocs/proxito/views/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from readthedocs.builds.constants import EXTERNAL, INTERNAL, LATEST, STABLE
from readthedocs.builds.models import Version
from readthedocs.core.mixins import CDNCacheControlMixin
from readthedocs.core.resolver import resolve_path
from readthedocs.core.resolver import resolve_path, resolver
from readthedocs.core.unresolver import (
InvalidExternalVersionError,
InvalidPathForVersionedProjectError,
Expand Down Expand Up @@ -281,7 +281,8 @@ def _get_canonical_redirect_type(self, request):
.filter(canonical=True, https=True)
.exists()
)
if canonical_domain:
# For .com we need to check if the project supports custom domains.
if canonical_domain and resolver._use_cname(project):
log.debug(
"Proxito Public Domain -> Canonical Domain Redirect.",
project_slug=project.slug,
Expand Down

0 comments on commit 96fe669

Please sign in to comment.