Skip to content

Commit 5166fba

Browse files
committed
Update app.controller.ts
1 parent b0c3757 commit 5166fba

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Controller, Get, Redirect } from '@nestjs/common';
1+
import { Controller, Get, Redirect, Headers } from '@nestjs/common';
22
import { AppService } from './app.service';
33

44
@Controller()
@@ -8,12 +8,11 @@ export class AppController {
88
// When a client makes a GET request to /vnc,
99
// this method will automatically redirect them to the noVNC URL.
1010
@Get('vnc')
11-
@Redirect(
12-
'/novnc/vnc.html?host=localhost&port=9990&path=websockify&resize=scale',
13-
302,
14-
)
15-
redirectToVnc(): void {
16-
// This method is intentionally left empty.
17-
// The @Redirect decorator will automatically redirect the client.
11+
// Leave the decorator empty but keep the status code.
12+
@Redirect(undefined, 302)
13+
redirectToVnc(@Headers('host') host: string) {
14+
return {
15+
url: `/novnc/vnc.html?host=${host}&path=websockify&resize=scale`,
16+
};
1817
}
1918
}

0 commit comments

Comments
 (0)