From c9395c7ed1e1af7f288e50415d03dcf421c15fd5 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 28 Mar 2019 16:38:22 +0200 Subject: [PATCH] Make exported web components work on hosts where https is proxied to http --- .../server/communication/WebComponentBootstrapHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/communication/WebComponentBootstrapHandler.java b/flow-server/src/main/java/com/vaadin/flow/server/communication/WebComponentBootstrapHandler.java index 47a9434fc06..795183aa8c3 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/communication/WebComponentBootstrapHandler.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/communication/WebComponentBootstrapHandler.java @@ -64,6 +64,9 @@ protected BootstrapContext createAndInitUI(Class uiClass, // remove path prefix but keep the trailing slash String serviceUrl = requestURL.substring(0, requestURL.length() - PATH_PREFIX.length() + 1); + // replace http:// or https:// with // to work with https:// proxies which proxies to the same http:// url + serviceUrl = serviceUrl.replaceFirst("^.*://", "//"); + assert serviceUrl.endsWith("/"); config.put(ApplicationConstants.SERVICE_URL, serviceUrl); return context;