diff --git a/bizmatch/src/app/app.routes.server.ts b/bizmatch/src/app/app.routes.server.ts index 063f93c..62fb946 100644 --- a/bizmatch/src/app/app.routes.server.ts +++ b/bizmatch/src/app/app.routes.server.ts @@ -1,7 +1,8 @@ import { RenderMode, ServerRoute } from '@angular/ssr'; export const serverRoutes: ServerRoute[] = [ - { path: 'home', renderMode: RenderMode.Prerender }, + // WICHTIG: home auf Server stellen! + { path: 'home', renderMode: RenderMode.Server }, { path: 'terms-of-use', renderMode: RenderMode.Prerender }, { path: 'privacy-statement', renderMode: RenderMode.Prerender }, { path: '**', renderMode: RenderMode.Server } diff --git a/bizmatch/src/environments/environment.base.ts b/bizmatch/src/environments/environment.base.ts index 023f4cb..beddc38 100644 --- a/bizmatch/src/environments/environment.base.ts +++ b/bizmatch/src/environments/environment.base.ts @@ -1,23 +1,20 @@ // SSR-safe: check if window exists // Im Browser nehmen wir den aktuellen Host (z.B. localhost). // Auf dem Server (SSR in Docker) nehmen wir 'bizmatch-app' (der Name des Backend-Containers). -const hostname = typeof window !== 'undefined' ? window.location.hostname : 'bizmatch-app'; -const isBrowser = typeof window !== 'undefined'; +const isBrowser = typeof window !== 'undefined' && window.navigator.userAgent !== 'node'; +const hostname = isBrowser ? window.location.hostname : 'bizmatch-app'; + // WICHTIG: Port anpassen! // Lokal läuft das Backend auf 3001. Im Docker Container auch auf 3001. // Deine alte Config hatte hier :4200 stehen, das war falsch (das ist das Frontend). -const port = 3001; -const protocol = typeof window !== 'undefined' ? 'http' : 'http'; // Intern im Docker meist http export const environment_base = { // apiBaseUrl: 'http://localhost:3000', // GETTER FUNCTION für die API URL (besser als statischer String für diesen Fall) get apiBaseUrl() { if (isBrowser) { - // Browser: Nutze die öffentliche HTTPS API return 'https://api.bizmatch.net'; } else { - // SSR (Docker): Nutze die interne HTTP Verbindung direkt zum Backend - // WICHTIG: http (nicht https) und Port 3001 + // SSR (Docker) nutzt interne Verbindung return 'http://bizmatch-app:3001'; } },