Skip to content

code: serve ext host worker from own origin #3257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions chart/config/proxy/vhost.server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ server {
server {
listen {{ $listen }};
# Matches:
# - (webview-|browser-)?+ foreign content prefix including UUID (optional). This must be possesive (?+) to not confuse "webview-8000-a1231-..." with a valid UUID
# - (webview-|browser-|extensions-)?+ foreign content prefix including UUID (optional). This must be possesive (?+) to not confuse "webview-8000-a1231-..." with a valid UUID
# - (?<wsid>[a-z][0-9a-z\-]+) workspace Id or blobserve
# - \.ws(-[a-z0-9]+)? workspace base domain
server_name ~^(webview-|browser-)?+(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$;
server_name ~^(webview-|browser-|extensions-)?+(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$;

{{- if $useHttps }}
{{- if eq .Values.ingressMode "pathAndHost" }}
Expand All @@ -153,12 +153,12 @@ server {
server {
listen {{ $listen }};
# Matches:
# - (webview-|browser-)?+ for now, we only support Theia webviews here! (TODO is there a - meaningful - way to generalize this?)
# - (webview-|browser-|extensions-)?+ for now, we only support Theia webviews here! (TODO is there a - meaningful - way to generalize this?)
# - (?<port>[0-9]{2,5})- port to forward to
# - (?<wsid>[a-z][0-9a-z\-]+) workspace Id
# - \.ws(-[a-z0-9]+)? workspace base domain
# "" needed because of {} (nginx syntax wart)
server_name "~^(webview-|browser-)?+(?<port>[0-9]{2,5})-(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$";
server_name "~^(webview-|browser-|extensions-)?+(?<port>[0-9]{2,5})-(?<wsid>[a-z0-9][0-9a-z\-]+)\.ws(-[a-z0-9]+)?\.${PROXY_DOMAIN_REGEX}$";

{{- if $useHttps }}
{{- if eq .Values.ingressMode "pathAndHost" }}
Expand Down
2 changes: 1 addition & 1 deletion components/ide/code/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN sudo apt-get update \
&& sudo apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

ENV GP_CODE_COMMIT 1bca02e66c4df443f716865592fe4dec16db5d7e
ENV GP_CODE_COMMIT fff45adc4e4a85b0944bd8a7dcb631e0018cb2c4
RUN mkdir gp-code \
&& cd gp-code \
&& git init \
Expand Down
4 changes: 2 additions & 2 deletions components/ws-proxy/pkg/proxy/workspacerouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func HostBasedRouter(header, wsHostSuffix string) WorkspaceRouter {
type hostHeaderProvider func(req *http.Request) string

func matchWorkspaceHostHeader(wsHostSuffix string, headerProvider hostHeaderProvider) mux.MatcherFunc {
r := regexp.MustCompile("^(webview-|browser-)?" + workspaceIDRegex + wsHostSuffix)
r := regexp.MustCompile("^(webview-|browser-|extensions-)?" + workspaceIDRegex + wsHostSuffix)
return func(req *http.Request, m *mux.RouteMatch) bool {
hostname := headerProvider(req)
if hostname == "" {
Expand Down Expand Up @@ -92,7 +92,7 @@ func matchWorkspaceHostHeader(wsHostSuffix string, headerProvider hostHeaderProv
}

func matchWorkspacePortHostHeader(wsHostSuffix string, headerProvider hostHeaderProvider) mux.MatcherFunc {
r := regexp.MustCompile("^(webview-|browser-)?" + workspacePortRegex + workspaceIDRegex + wsHostSuffix)
r := regexp.MustCompile("^(webview-|browser-|extensions-)?" + workspacePortRegex + workspaceIDRegex + wsHostSuffix)
return func(req *http.Request, m *mux.RouteMatch) bool {
hostname := headerProvider(req)
if hostname == "" {
Expand Down