Skip to content

Commit

Permalink
Fix bug in handling Theia VSIX webview/mini-browser URIs
Browse files Browse the repository at this point in the history
- Bug introduced by commit 978a597
- webview and minibrowser URIs must be explicitly parsed
  • Loading branch information
struanb committed Sep 7, 2023
1 parent e0db67d commit 6eedc35
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/server/lib/Proxy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ sub domain_to_host {
# - 1: 'my-devtainer', 'www', 'mydockside.co.uk', 1 (as seen by an inner Dockside devtainer; will proxy on to 'my-devtainer')

if( $host =~ /^([^\.]+)\.(.*?)(:\d+)?$/ ) {
my @elements = reverse split(/--/, $1);

# Split on two and only two dashes; these separate nested Dockside containers
my @elements = reverse split(/(*nlb:-)--(*nla:-)/, $1);
my $domain = $2;

# Split again the leftmost element on its first '-'.
# Retain <service> (e.g. 'ide') or e.g. 8eb55c33-985f-406e-b9e7-a8b0c4962e1e-wv-<service> as $service
# Add the devtainer name (if found) to @elements.
# Always add the service name to @elements.
my ($service, $topHost) = pop(@elements) =~ /^([^-]+)(?:-(.*))?$/;
# See launch-ide.sh THEIA_WEBVIEW_EXTERNAL_ENDPOINT and THEIA_MINI_BROWSER_HOST_PATTERN.
my ($service, $topHost) = pop(@elements) =~ /^((?:.*-(?:wv|mb|webview|minibrowser)-)?[^-]+)(?:-(.*))?$/;
push(@elements, $topHost ? $topHost : (), $service);

my $nestCount = split(/-/, $r->header_in('X-Nest-Level'));
Expand Down

0 comments on commit 6eedc35

Please sign in to comment.