Disabling tenant should return Tenant disabled instead of 404 not found
Describe the bug
Disabling Tenant should return appropriate message instead of 404.
To Reproduce
Steps to reproduce the behavior:
- Go to Tenants
- Disable a Tenant
- Go to tenant home page
- See 404 reported on Default tenant .
Expected behavior
It should display Tenant disabled instead of 404 not found on default tenant
Why would that be more appropriate than a 404? If you disable a tenant, none of its pages will exist anymore, much like the tenant not existing at all.
What about 204?
Technically it should be 403/503 with message "Tenant disabled"
Why would that be more appropriate than a 404? If you disable a tenant, none of its pages will exist anymore, much like the tenant not existing at all.
Because pages still there, but were disabled, and those may be enabled sometime later.
That's not something that would concern end-users though. What's more, as an administrator, I'd expect a tenant disable to be virtually the same to a deletion as far as users are aware. This might be a necessity compliance-wise too.
503 service unavailable makes sense.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
We could then set a specific error message for when a tenant is disabled.
This is you get when azure site is disabled

403 is a client error while 503 is a server error. Depends how you see it.
Maybe an option on the tenant?
Also, what is the "problem" with 404. And how is that an issue for you? Saying "azure web apps does it" is not an issue to fix.
@sebastienros the issue with 404 is - as it's trying to search in Default tenant and Default tenant's UI is rendered
In the case you want a custom code, the tenant resolution should still succeed and return "a blank page" with the code. The tenant can't have any content since it's disabled. Or should it be a static file from the host that is common to all tenants (like the error shape).
NB: It returns a 404 from the default tenant because if 'foo.com' is the default tenant, and tenant1 is a disabled url prefixed tenant, then 'foo.com/tenant1' is an unknown page for foo.com.
Yes, when a tenant is disabled it is removed from the RunningShellTable so for this service it's like it doesn't exist anymore, but this tenant is still in the ShellHost inner disctionaries.
As @Skrypt mentioned on a PR, the thing to check (and fix) is that if a tenant has a different domain than the default one and is disabled, then it should not return a 404 from the default tenant. It "may" return a 404 from the requested domain, or another status code.
If the tenant has the same domain as the default tenant, then we should return a 404 (as it is the case today).