mercredi 20 juillet 2022

Domain based routing by a base controller

I have a multi-domain application.

Currently, I'm using [Host("domain.com")] to distinguish controllers.

At the same time, I have custom base controllers for each application, so I want to simplify this a bit. Ideally, I want to get all controllers inherited from a specified type and require them to be served from a specific domain.

  1. I don't use a custom endpoint configuration, so RequireHost will not work
  2. I'm trying avoiding to create a custom PolicyMatcher. In common, I can copy-paste the existing policy and inject some matching strategy e.g. base class checks, etc. But I'd rather not to do that.
  3. I don't want to use HostAttribute, or at least to subclass it (but it is sealed) to create a pre-defined attribute for the exact domain

Is there another option to implement a domain routing based on a base controller, or to address this requirement?





Aucun commentaire:

Enregistrer un commentaire