Open Closed

Tenant Subdomain resolver issue on Azure and localhost #6634


User avatar
0
franciscokadzi@gmail.com created
  • ABP Framework version: v7.4.2
  • UI Type: Angular
  • Database System: EF Core (SQL Server
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have configured Tenant subdomain resolver for my application using the following documentation https://community.abp.io/posts/how-to-use-domainbased-tenant-resolver-in-abp-with-angular-and-openiddict-v9y8da7v and this https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-subdomain-tenant-resolver

I have also looked at this question https://support.abp.io/QA/Questions/6606/Unable-to-configure-sub-domain-in-the-Application

But I have the following problems

  1. I am unable to get it to work on Azure although I have wildcards configured. I get 404 and sometimes a NET::ERR_CERT_COMMON_NAME_INVALID error message. while accessing any tenant subdomain
  2. In localhost I am able to get it to work, but it only works in Edge but not Firefox and Chrome browsers.

Firefox error

Chrome error

  1. Can you provide detailed guidelines on how to get Tenant subdomain to work on Azure (My current setup has Angular on Static Web Apps and API/Backend on Appservice(Linux))
  2. Can you help me figure out why Everything works fine on Egde but not Chrome and Firefox

In edge http://2frankzi.localhost:4200 correctly redirects to https://2frankzi.localhost:44348/Account/Login?ReturnUrl and back after authentication


5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you try this?

    "CorsOrigins": "https://*.localhost:4200,https://localhost:4200/"

    https://github.com/abpframework/abp-samples/blob/master/DomainTenantResolver/OpenIddict/NG/aspnet-core/src/BookStore.HttpApi.Host/appsettings.json#L4

  • User Avatar
    0
    franciscokadzi@gmail.com created

    Hi, I already have that in my appsettings. This is what I have

    {
      "App": {
        "SelfUrl": "https://localhost:44348",
        "AngularUrl": "http://localhost:4200",
        "CorsOrigins": "http://*.localhost:4200,http://localhost:4200",
        "RedirectAllowedUrls": "http://localhost:4200,http://*.localhost:4200",
        "DisablePII": "false",
        "HealthCheckUrl": "/health-status"
      },
      "ConnectionStrings": {
        "Default": "Server=NAELI\\SQLEXPRESS;Database=MyApp;Trusted_Connection=True;TrustServerCertificate=True;"
      },
      "AuthServer": {
        "Authority": "https://localhost:44348",
        "RequireHttpsMetadata": "true",
        "SwaggerClientId": "MyApp_Swagger"
      },
      "StringEncryption": {
        "DefaultPassPhrase": "yMdNzBpz3TdwXUc8"
      }
    }
    

    and my environment.ts file

    import { Environment } from '@abp/ng.core';
    
    const baseUrl = 'http://{0}.localhost:4200';
    
    const oAuthConfig = {
      issuer: 'https://{0}.localhost:44348/',
      redirectUri: baseUrl,
      clientId: 'MyApp_App',
      responseType: 'code',
      scope: 'offline_access MyApp',
      requireHttps: true,
    };
    
    export const environment = {
      production: false,
      application: {
        baseUrl,
        name: 'MyApp',
        logoUrl: '../assets/images/logo/logo-light.svg',
      },
      oAuthConfig,
      apis: {
        default: {
          url: 'https://{0}.localhost:44348',
          rootNamespace: 'MyApp',
        },
        AbpAccountPublic: {
          url: oAuthConfig.issuer,
          rootNamespace: 'AbpAccountPublic',
        },
      },
    } as Environment;
    
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is not related to ABP.

    The HTTP request which makes use of CORS failed because the HTTP connection failed at either the network or protocol level. The error is not directly related to CORS, but is a fundamental network error of some kind.

    You can check this: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed

  • User Avatar
    0
    franciscokadzi@gmail.com created

    Hi I have been able to work around the chrome and firefox issues locally. Everything works as expected locally But the azure issue remains the same. I get this error on azure NET::ERR_CERT_COMMON_NAME_INVALID and 404 error.

    I have tried the suggestion in the following tickets but it seems not to help.

    https://support.abp.io/QA/Questions/1876 https://support.abp.io/QA/Questions/6105/Subdomain-Tenant-Resolver-not-working-on-non-development-environment https://support.abp.io/QA/Questions/1552/Better-Documentation-for-Multi-Tenant-Subdomain-Resolver https://support.abp.io/QA/Questions/6606/Unable-to-configure-sub-domain-in-the-Application

    If necessary I can provide access to the repo so you check. we could also get on a zoom call or anything you can do to help

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    But the azure issue remains the same. I get this error on azure NET::ERR_CERT_COMMON_NAME_INVALID and 404 error.

    Hi, could you share some screenshots and error log?

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09