-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(api): Add organization_id_or_slug
Support to Customer Domain Middleware
#70172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes makes sense to be but a hybrid cloud stamp would be nice. @dashed ?
result.kwargs | ||
and "organization_slug" in result.kwargs | ||
and result.kwargs["organization_slug"] != activeorg | ||
org_slug_path_mismatch = result.kwargs and ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this easier to understand, with this solution, if ID is passed in organization_id_or_slug
and it is not the correct ID of the active org redirect_url stays activeorg url but kwargs["organization_id_or_slug"]
remain the wrong ID so this leads to 404. I think it's expected but just clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep thats correct. In general, this scenario shouldn't be happening because the org_id should only be used in subdomain-less queries.
# No redirect for id | ||
response = self.client.get( | ||
reverse("org-events-endpoint-id-or-slug", kwargs={"organization_id_or_slug": 1234}), | ||
data={"querystring": "value"}, | ||
HTTP_HOST="albertos-apples.testserver", | ||
follow=True, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this scenario in saas, we'll end up going through the API gateway middleware and being proxied to the organization's region based on the 1234
slug and the subdomain will be ignored. I think that is a reasonable outcome as all slug subdomains resolve to control silo instances.
We are updating our APIs work with id and slug path params. We need to make sure that the middleware works with both type of path params. We need to make sure that if an orgid is passed, we don't redirect them.
For more context: https://sentry.slack.com/archives/C032E82D338/p1714605291155389
Example:
acme.sentry.io/organizations/12345/issues
tohttp://12345.sentry.io/issues
.