Use per-deploy preview hosts under the site root domain.

Build hosts as <userPrefix>-<deploymentNumber>-preview.<rootDomain> from FRONTEND_URL, wire them through ingress/TLS, and open them from the preview API.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-27 12:48:22 +03:30
parent 44ad1d63a0
commit be2587dcf5
8 changed files with 210 additions and 22 deletions
@@ -409,7 +409,10 @@ export class ApplicationsController {
@ApiOperation({ summary: 'Get preview URL for the deployed application' })
async getPreview(@Param('id') id: string, @Request() req: any) {
const app = await this.applicationsService.findOne(id, this.staffUserIdFilter(req));
return this.kubernetesService.getPreviewInfo(app);
const deployments = await this.deploymentsService.findByApplication(app.id);
const latest = deployments.find((d) => d.status === 'running') || deployments[0];
const previewNumber = latest?.previewSubdomain ?? null;
return this.kubernetesService.getPreviewInfo(app, previewNumber);
}
@Post(':id/access')