[MRG]: badge_base_url can be a function that gets the parameter from the HTTP RequestHandler #1031
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows the
badge_base_url
setting and therefore theBINDER_LAUNCH_HOST
environment variable to be set from a HTTP request, and is intended to allow a BinderHub to have different values of the variable depending on the original source of the request.For example, Gesis currently has a mix of
https://mybinder.org
andhttps://notebooks.gesis.org/binder
in different places. By changingbadge_base_url
to check for a parameter in the request it should be possible to have the URLs match consistently depending on whether the user was redirected from mybinder (e.g. the redirector could set a query parameterbinder_launch_host=https://mybinder.org/
) or directly (no parameter, default behaviour).For example:
See discussion starting from jupyterhub/mybinder.org-deploy#1284 (comment)
I've tested this locally using curl:
curl http://binder-test-host/build/gh/manics/jupyter-offlinenotebook/7ba3520553c414d0b55e80b96c0f6df85f903078?binder_launch_host=https://mybinder.org
this will spit out a URL and token that can be copied into a browser.
To work with the mybinder federation this will require the parameter to be passed in proxy requests made by the redirector: