OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

Disabling tenant should return Tenant disabled instead of 404 not found

Open ns8482e opened this issue 4 years ago • 15 comments

Describe the bug

Disabling Tenant should return appropriate message instead of 404.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Tenants
  2. Disable a Tenant
  3. Go to tenant home page
  4. See 404 reported on Default tenant .

Expected behavior

It should display Tenant disabled instead of 404 not found on default tenant

ns8482e avatar Feb 18 '22 18:02 ns8482e

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.

Piedone avatar Feb 18 '22 19:02 Piedone

What about 204?

hishamco avatar Feb 18 '22 19:02 hishamco

Technically it should be 403/503 with message "Tenant disabled"

ns8482e avatar Feb 18 '22 21:02 ns8482e

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.

dohoangtung avatar Apr 11 '22 02:04 dohoangtung

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.

Piedone avatar Apr 11 '22 14:04 Piedone

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.

Skrypt avatar Apr 11 '22 15:04 Skrypt

This is you get when azure site is disabled image

ns8482e avatar Apr 11 '22 20:04 ns8482e

403 is a client error while 503 is a server error. Depends how you see it.

Skrypt avatar Apr 11 '22 23:04 Skrypt

Maybe an option on the tenant?

sebastienros avatar Apr 14 '22 17:04 sebastienros

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 avatar Apr 14 '22 17:04 sebastienros

@sebastienros the issue with 404 is - as it's trying to search in Default tenant and Default tenant's UI is rendered

ns8482e avatar Sep 04 '22 16:09 ns8482e

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).

sebastienros avatar Sep 08 '22 17:09 sebastienros

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.

sebastienros avatar Sep 08 '22 17:09 sebastienros

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.

jtkech avatar Sep 08 '22 19:09 jtkech

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).

sebastienros avatar Sep 15 '22 17:09 sebastienros