So I had the right idea but wrong followthrough
Because a tenant 'Default' exists it tried to push me there I needed to change my app-session to this:
init(): Promise<UiCustomizationSettingsDto> {
if (environment.production && (!AppConsts.tenantName || this.checkTenant())) {
window.location.href = environment.siteRoute;
}
return new Promise<UiCustomizationSettingsDto>((resolve, reject) => {
this._sessionService.getCurrentLoginInformations().toPromise().then((result: GetCurrentLoginInformationsOutput) => {
this._application = result.application;
this._user = result.user;
this._tenant = result.tenant;
this._theme = result.theme;
resolve(result.theme);
}, (err) => {
reject(err);
});
});
}
checkTenant() {
let input = new IsTenantAvailableInput();
input.tenancyName = AppConsts.tenantName;
if (AppConsts.tenantName.toLowerCase() === 'portal') {
return false;
}
this._accountService.isTenantAvailable(input)
.subscribe((result: IsTenantAvailableOutput) => {
switch (result.state) {
case TenantAvailabilityState.Available:
console.log('Available');
return false;
case TenantAvailabilityState.InActive:
console.log('InActive');
return false;
case TenantAvailabilityState.NotFound:
console.log('NotFound');
window.location.href = environment.siteRoute;
return true;
default:
return false;
}
});
}
changeTenantIfNeeded(tenantId?: number): boolean {
if (this.isCurrentTenant(tenantId)) {
return false;
}
abp.multiTenancy.setTenantIdCookie(tenantId);
location.reload();
return true;
}
private isCurrentTenant(tenantId?: number) {
let isTenant = tenantId > 0;
if (AppConsts.tenantName.toLowerCase() === 'portal') { // this is new host
return true;
}
if (!isTenant && !this.tenant) { // this is host
return true;
}
if (!tenantId && this.tenant) {
return false;
} else if (tenantId && (!this.tenant || this.tenant.id !== tenantId)) {
return false;
}
return true;
}
@maliming - everything works except I cant access Host account any longer I noticed that the Host account on main database had tenant name of 'Default' so I assumed that would take me to Host account default.mysite.com just takes me to a tenant called default with No Host permissions
In app-session.service.ts I updated isCurrentTenant method:
private isCurrentTenant(tenantId?: number) {
let isTenant = tenantId > 0;
if (tenantId === 1 && AppConsts.tenantName.toLowerCase() === 'default') { // this is new host
return true;
} ...
I am unsure where I can alias my host account - now that http://mysite.com goes to my wordpress site
We're using Angular2/.NETCore setup and I found the AppPreBootstrap.ts file
I frankensteined a new method within AppPreBootstrap.run:
[...] const queryStringObj = UrlHelper.getQueryParameters();
// Go to External site if tenant doesn't exist
if (AppPreBootstrap.checkTenant(() => { AppPreBootstrap.getUserConfiguration(callback); })) {
window.location.href = environment.siteRoute;
}
if (queryStringObj.redirect && queryStringObj.redirect === 'TenantRegistration') { [...]
// New check method
private static checkTenant(callback: () => void): boolean {
let returnVal = false;
console.log('checkTenant');
const subdomainTenancyNameFinder = new SubdomainTenancyNameFinder();
const tenancyName = subdomainTenancyNameFinder.getCurrentTenancyNameOrNull(AppConsts.appBaseUrl);
let input = new IsTenantAvailableInput();
input.tenancyName = tenancyName;
let requestHeaders = AppPreBootstrap.getRequetHeadersWithDefaultValues();
XmlHttpRequestHelper.ajax(
'POST',
AppConsts.remoteServiceBaseUrl + '/api/services/app/Account/IsTenantAvailable',
requestHeaders,
input,
(response) => {
let result = response.result;
switch (result.state) {
case TenantAvailabilityState.Available:
returnVal = false;
break;
case TenantAvailabilityState.InActive:
returnVal = false;
break;
case TenantAvailabilityState.NotFound:
returnVal = true;
break;
}
callback();
}
);
return returnVal;
}
Failed to load resource: the server responded with a status of 400 (Bad Request) [http://localhost:19945/api/services/app/Account/IsTenantAvailable?d=1589320901545]
I kept trying with no success so I deciced to put the reroute code somewhere else. I thought app-session.service would be a good place and modified init:
init(): Promise<UiCustomizationSettingsDto> {
if (!AppConsts.tenantName || this.checkTenant()) {
window.location.href = environment.siteRoute;
}...
------------
checkTenant(): boolean {
let returnVal = false;
let input = new IsTenantAvailableInput();
input.tenancyName = AppConsts.tenantName;
this._accountService.isTenantAvailable(input)
.subscribe((result: IsTenantAvailableOutput) => {
switch (result.state) {
case TenantAvailabilityState.NotFound: //NotFound
window.location.href = environment.siteRoute;
break;
}
});
return returnVal;
}
I ended up with this which seems to do what I need it to
"Azure is preventing access." this ended up being the issue
Azure had a visual error which wouldn't show that the port wasn't saved so the application was blocking all traffic Refreshed, reset Azure, all working
perfect, thanks for confirming
https://stackoverflow.com/questions/20146410/computer-blocking-cors-options-request https://www.bennadel.com/blog/2559-cisco-anyconnect-vpn-client-may-block-cors-ajax-options-requests.htm
its an issue with the VPN in question - closing ticket
I can hit the Swagger page from a local browser I can hit the WebUI page from local and external I was never able to ping the API from outside of the virutal machine
there was 2 consistent errors from what I can remember The first was relating to CORS mismatch, the second failed in the first GetAll method like when it can't find the API
to confirm, no one else is reporting SSL issues and you guys are able to test that there is no issue on the application, correct?
what do the API logs say?