vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
622 stars 166 forks source link

Forced use of the protocol specific URL in WC bootstrap handler breaks loading in some scenarios #13315

Open paulroemer opened 2 years ago

paulroemer commented 2 years ago

Description of the bug

Using an embeddable Vaadin component (WC exporter) deployed on a proxied https host in a non-http hosted static HTML page fails due to the forced rewrite of the given URL.

Code where the rewrite happens: https://github.com/vaadin/flow/blob/master/flow-server/src/main/java/com/vaadin/flow/server/communication/WebComponentBootstrapHandler.java#L541

Scenario: We have deployed the embeddable component on https://exported.wc/ and want to use it locally for development on http://localhost/. The request is https://exported.wc/embeddable/web-component/web-component-bootstrap.js?url=https://exported.wc/embeddable/web-component/web-component-bootstrap.js. But because of the rewrite of the URL, the resolved URL is //exported.wc/embeddable/web-component/web-component-bootstrap.js.

All of that wouldn't be bad (http://exported.wc/ is 301 redirected to https://) if CORS wouldn't block the redirect response.

Expected behavior

Do not rewrite the URL at all. Actually, I am not sure what this rewrite should fix.

Minimal reproducible example

-

Versions

Vaadin 22

caalador commented 2 years ago

I could by searching history find the change as https://github.com/vaadin/flow/pull/5374 @Artur- would you remember anything about this change?

mshabarov commented 2 years ago

Not sure if it's a bug or enhancement, IMO something in the middle. @paulroemer to help us investigate this issue, could you please provide an example to reproduce or steps how to reproduce it, desirably with description how to set up the local environment for this.