Commit 5dccb78
fix: run TenantMiddleware before session load for Redis multitenant (#980)
UseAsyncSession eagerly calls Session.LoadAsync(), which resolves the
tenant namespace from HttpContext.Items. Since TenantMiddleware ran after
UseAsyncSession, the tenant id was unset at load time and fell back to
"default", so per-subdomain sessions were read from the wrong Redis
namespace and lost across requests. Move TenantMiddleware before the
session middleware so the tenant id is set before the session is loaded.
Co-authored-by: claudiamurialdo <33756655+claudiamurialdo@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e0ef479 commit 5dccb78
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
593 | 601 | | |
594 | 602 | | |
595 | 603 | | |
596 | 604 | | |
597 | 605 | | |
598 | 606 | | |
599 | 607 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | 608 | | |
604 | 609 | | |
605 | 610 | | |
| |||
0 commit comments