Skip to content
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

Properly handle prefix="" in CustomProvider() #944

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flyn-org
Copy link

@flyn-org flyn-org commented Apr 5, 2024

It might be that an app could support either running behind a reverse proxy or directly. In the latter case, prefix would be "". This modifies CustomProvider to properly handle that case.

Previously, CustomProvider() would apply this to prefix unconditionally:

        prefix = "/" + strings.Trim(prefix, "/")

Starting with prefix = "", prefix would become "/", making appWASM "//web/app.wasm". A browser that acted on such a path might erroneously load, e.g., "http://web/app.wasm".

Now, CustomProvider() only trims and concatenates when prefix != "".

It might be that an app could support either running behind a reverse
proxy or directly. In the latter case, prefix would be "". This modifies
CustomProvider to properly handle that case.

Previously, CustomProvider() would apply this to prefix unconditionally:

	prefix = "/" + strings.Trim(prefix, "/")

Starting with prefix = "", prefix would become "/", making appWASM
"//web/app.wasm". A browser that acted on such a path might erroneously
load, e.g., "http://web/app.wasm".

Now, CustomProvider() only trims and concatenates when prefix != "".

Signed-off-by: W. Michael Petullo <mike@flyn.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant