diff --git a/configs/deployment/docker-compose-app.yml b/configs/deployment/docker-compose-app.yml index f1a8b1b2..7733d6c7 100644 --- a/configs/deployment/docker-compose-app.yml +++ b/configs/deployment/docker-compose-app.yml @@ -43,6 +43,8 @@ services: profiles: ["app"] ports: - 3002:80 # ⚠️ UI uygulaması için dış port açıldı + volumes: + - /home/user/sozsoft.com:/etc/ssl/sozsoft.com:ro networks: - default diff --git a/ui/src/services/tenants.ts b/ui/src/services/tenants.ts index 7d142e95..87ddf5c4 100644 --- a/ui/src/services/tenants.ts +++ b/ui/src/services/tenants.ts @@ -1,6 +1,7 @@ // scripts/tenant.ts import axios from 'axios' import https from 'https' +import fs from 'fs' export type TenantDto = { name: string } export type PagedResultDto = { totalCount: number; items: T[] } @@ -10,12 +11,15 @@ export async function fetchTenantNames(apiUrl: string): Promise { const url = `${apiUrl.replace(/\/$/, '')}/api/app/platform-tenant?skipCount=0&maxResultCount=1000` const isLocalHttps = /^https:\/\/localhost(:\d+)?/i.test(apiUrl) + const ca = fs.readFileSync('../etc/ssl/sozsoft.com/cert1.pem') + const agent = new https.Agent({ ca }) + const response = await axios.get>(url, { headers: { Accept: 'application/json', 'X-Requested-With': 'XMLHttpRequest', }, - httpsAgent: isLocalHttps ? new https.Agent({ rejectUnauthorized: false }) : undefined, + httpsAgent: isLocalHttps ? new https.Agent({ rejectUnauthorized: false }) : agent, }) return (response.data.items ?? []).map((t: TenantDto) => t.name.trim().toLowerCase()) diff --git a/ui/vite.config.ts b/ui/vite.config.ts index a7a6c1c5..ac077582 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -6,12 +6,18 @@ import { VitePWA } from 'vite-plugin-pwa' import { fetchTenantNames } from './src/services/tenants' export default defineConfig(async ({ mode }) => { - const baseDomains = ['sozsoft.com', 'dev.sozsoft.com'] const env = loadEnv(mode, process.cwd(), '') const apiUrl = env.VITE_API_URL - const tenantNames = await fetchTenantNames(apiUrl) + const baseDomains = ['sozsoft.com', 'dev.sozsoft.com'] + const tenantNames = (await fetchTenantNames(apiUrl)).map((n) => n.trim().toLowerCase()) const tenantHosts = tenantNames.flatMap((t) => baseDomains.map((d) => `${t}.${d}`)) const allowedHosts = Array.from(new Set(['localhost', ...baseDomains, ...tenantHosts])) + + console.log('[vite] env:', env) + console.log('[vite] url:', apiUrl) + console.log('[vite] tenants:', tenantNames) + console.log('[vite] allowedHosts:', allowedHosts) + return { plugins: [ react({