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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user