diff --git a/lambdas/api/handler.py b/lambdas/api/handler.py index 56b4ca0..a467f62 100644 --- a/lambdas/api/handler.py +++ b/lambdas/api/handler.py @@ -87,8 +87,9 @@ def _base_url(event: dict) -> str | None: # A custom domain (base-path mapping) serves the stage at the root, so the # public URL has NO /{stage} segment; only the raw execute-api host carries # it. Emitting /{stage} for a custom-domain request would advertise a - # broken server URL in the docs. - if ".execute-api." in domain: + # broken server URL in the docs. All API Gateway default domains end with + # .amazonaws.com, so check the suffix rather than a substring. + if domain.endswith(".amazonaws.com"): return f"https://{domain}/{stage}" if stage else None return f"https://{domain}"