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:
@@ -867,9 +867,13 @@ export default function AppDetailPage() {
|
||||
const previewMutation = useMutation({
|
||||
mutationFn: () => api.get(`/applications/${appId}/preview`).then((r) => r.data),
|
||||
onSuccess: (data: { url: string; nodePort: number; host: string; ingressUrl?: string }) => {
|
||||
// Open the preview URL in a new tab
|
||||
window.open(data.url, '_blank');
|
||||
toast.success(`Preview opened on port ${data.nodePort}`);
|
||||
const targetUrl = data.ingressUrl || data.url;
|
||||
window.open(targetUrl, '_blank');
|
||||
if (data.ingressUrl) {
|
||||
toast.success('Preview opened on HTTPS preview domain.');
|
||||
} else {
|
||||
toast.success(`Preview opened on port ${data.nodePort}`);
|
||||
}
|
||||
},
|
||||
onError: () => toast.error('Failed to get preview URL. Make sure the app is deployed.'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user