Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions web/packages/teleport/src/AppLauncher/AppLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ export function AppLauncher() {
const queryParams = new URLSearchParams(search);

const createAppSession = useCallback(async (params: UrlLauncherParams) => {
let fqdn = params.fqdn;
const port = location.port ? `:${location.port}` : '';

try {
let fqdn = params.fqdn;
if (!fqdn) {
const app = await service.getAppFqdn(params);

fqdn = app.fqdn;
}

Expand All @@ -48,7 +49,6 @@ export function AppLauncher() {
params.arn = decodeURIComponent(params.arn);
}

const port = location.port ? `:${location.port}` : '';
const session = await service.createAppSession(params);

await fetch(`https://${fqdn}${port}/x-teleport-auth`, {
Expand All @@ -72,7 +72,11 @@ export function AppLauncher() {
window.location.replace(`https://${fqdn}${port}${path}`);
} catch (err) {
let statusText = 'Something went wrong';
if (err instanceof Error) {

if (err instanceof TypeError) {
// `fetch` returns `TypeError` when there is a network error.
statusText = `Unable to access "${fqdn}". This may happen if your Teleport Proxy is using untrusted or self-signed certificate. Please ensure Teleport Proxy service uses valid certificate or access the application domain directly (https://${fqdn}${port}) and accept the certificate exception from your browser.`;
} else if (err instanceof Error) {
statusText = err.message;
}

Expand Down