sentry icon indicating copy to clipboard operation
sentry copied to clipboard

feat(hybrid-cloud): Set active org based on subdomain

Open dashed opened this issue 3 years ago • 3 comments

Branched from https://github.com/getsentry/sentry/pull/37037


This pull request adds the CustomerDomainMiddleware middleware that sets the active organization based on request.subdomain. In addition, region domains are ignored (e.g. us.sentry.io).

For example, if the user is accessing acme.sentry.io, then acme will be the active organization, regardless of what the previous (if any) active organization was.

Redirects are also handled. For example if http://acme.sentry.io/organizations/sentry/issues/ was accessed, then a 302 Redirect response will be generated with http://acme.sentry.io/organizations/acme/issues/.

The activation of the CustomerDomainMiddleware middleware will be in a follow up pull request.

dashed avatar Jul 27 '22 06:07 dashed

@AniketDas-Tekky Is RequestFactory() not sufficient? Can you give me an example of what test you're looking for?

dashed avatar Jul 28 '22 00:07 dashed

@dashed https://github.com/getsentry/sentry/blob/master/tests/sentry/ratelimits/utils/test_enforce_rate_limit.py#L37

AniketDas-Tekky avatar Jul 28 '22 21:07 AniketDas-Tekky

@AniketDas-Tekky I've added some tests that emulates the request/response on the Django framework with and without the CustomerDomainMiddleware middleware.

dashed avatar Aug 06 '22 00:08 dashed