Fixed the reverse proxy

pull/3895/head
tidusjar 6 years ago
parent f4903419d3
commit 11f91de16b

@ -83,9 +83,9 @@ const routes: Routes = [
// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient, platformLocation: PlatformLocation) {
// const base = getBaseLocation();
const base = platformLocation.getBaseHrefFromDOM();
const base = '/' + (window.location.pathname.split('/')[1] || '')
const version = Math.floor(Math.random() * 999999999);
if (base.length > 1) {
if (base !== null && base.length > 1) {
return new TranslateHttpLoader(http, `${base}/translations/`, `.json?v=${version}`);
}
return new TranslateHttpLoader(http, "/translations/", `.json?v=${version}`);
@ -181,11 +181,10 @@ export function JwtTokenGetter() {
MessageService,
StorageService,
SignalRNotificationService,
{ provide: APP_BASE_HREF, useValue: window['_app_base'] || '/' }
// {
// provide: APP_BASE_HREF,
// useFactory: getBaseLocation
// }
{
provide: APP_BASE_HREF,
useValue: '/' + (window.location.pathname.split('/')[1] || '')
}
],
bootstrap: [AppComponent],
})

@ -5,43 +5,43 @@
<script>
// manually sets the <base> tag's href attribute so the app can be located in places other than root
var split = location.pathname.split('/');
var base = "";
var invalidProxies = ['DISCOVER',
'REQUESTS-LIST',
'DETAILS',
'SETTINGS',
'ISSUES',
'USERMANAGEMENT',
'RECENTLYADDED',
'DETAILS',
'VOTE',
'LOGIN',
'LANDINGPAGE',
'TOKEN',
'RESET',
'CUSTOM',
'AUTH',
'WIZARD',
"CALENDAR"
]
for (var i = 0; i < split.length - 1; i++) {
if( invalidProxies.indexOf(split[i].toUpperCase()) !== -1) {
break;
}
base += split[i];
if(base.length > 1) {
break;
}
if (i < split.length - 2) {
base += "/";
}
}
if(base === "") {
base = "/";
}
window['_app_base'] = base;
document.write("<base href='" + base + "' />");
// var split = location.pathname.split('/');
// var base = "";
// var invalidProxies = ['DISCOVER',
// 'REQUESTS-LIST',
// 'DETAILS',
// 'SETTINGS',
// 'ISSUES',
// 'USERMANAGEMENT',
// 'RECENTLYADDED',
// 'DETAILS',
// 'VOTE',
// 'LOGIN',
// 'LANDINGPAGE',
// 'TOKEN',
// 'RESET',
// 'CUSTOM',
// 'AUTH',
// 'WIZARD',
// "CALENDAR"
// ]
// for (var i = 0; i < split.length - 1; i++) {
// if( invalidProxies.indexOf(split[i].toUpperCase()) !== -1) {
// break;
// }
// base += split[i];
// if(base.length > 1) {
// break;
// }
// if (i < split.length - 2) {
// base += "/";
// }
// }
// if(base === "") {
// base = "/";
// }
// window['_app_base'] = base;
// document.write("<base href='" + base + "' />");
</script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">

Loading…
Cancel
Save