diff --git a/readthedocs/proxito/middleware.py b/readthedocs/proxito/middleware.py index b17e483da98..ceb62b24bfa 100644 --- a/readthedocs/proxito/middleware.py +++ b/readthedocs/proxito/middleware.py @@ -281,11 +281,22 @@ def process_request(self, request): # noqa def add_hosting_integrations_headers(self, request, response): project_slug = getattr(request, "path_project_slug", "") + version_slug = getattr(request, "path_version_slug", "") + if project_slug: project = Project.objects.get(slug=project_slug) if project.has_feature(Feature.HOSTING_INTEGRATIONS): response["X-RTD-Hosting-Integrations"] = "true" + # Inject the new integrations for versions using `build.commands` + version = project.versions.filter(slug=version_slug).first() + if ( + version + and version.config + and version.config.get("build", {}).get("commands", {}) != [] + ): + response["X-RTD-Hosting-Integrations"] = "true" + def process_response(self, request, response): # noqa self.add_proxito_headers(request, response) self.add_cache_headers(request, response)