Bug description
Not sure if this is a "bug" or misunderstanding of configuration, or a missing feature to be honest.
My use case
- Externally managed traefik proxy that handles some other services besides jupyterhub
- External access via https with SNI (routing based on Host even when using TLS)
- Using FileProvider, generating only dynamic rules
Dynamic routing rules generated by traefik-proxy ignore domain supplied in .public_url configuration.
Expected behaviour
I expect routing rules to include Host() component if that was configured in JupyterHub.bind_url, instead Host rule is only included when jupyterhub runs with host based routing.
If bind_url="https://example.com", I expect dynamic routing rules to be
Host(`example.com`)&&(PathPrefix(`/{ROUTESPEC}/`)||Path(`/{ROUTESPEC}`))
Actual behaviour
generated dynamic routing rules only include PathPrefix and Path rules. Confirmed by code inspection here:
|
if routespec.startswith("/"): |
|
# Path-based route, e.g. /proxy/path/ |
|
host = "" |
|
path = routespec |
|
else: |
|
# Host-based routing, e.g. host.tld/proxy/path/ |
|
host, slash, path = routespec.partition("/") |
|
path = slash + path |
|
|
|
path_no_slash = path.rstrip("/") |
|
|
|
path_rule = f"PathPrefix(`{path}`)" |
|
if path_no_slash: |
|
# include exact Path('/prefix') so that both /prefix/ and /prefix |
|
# are served correctly |
|
path_rule = f"( {path_rule} || Path(`{path_no_slash}`) )" |
|
|
|
if host: |
|
rule = f"Host(`{host}`) && {path_rule}" |
|
else: |
|
rule = path_rule |
I think generate_rule function should take host argument extracted from .public_url configuration and if that is not empty include it in the rule.
How to reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Your personal set up
Full environment
# paste output of `pip freeze` or `conda list` here
Configuration
Logs
Bug description
Not sure if this is a "bug" or misunderstanding of configuration, or a missing feature to be honest.
My use case
Dynamic routing rules generated by
traefik-proxyignore domain supplied in.public_urlconfiguration.Expected behaviour
I expect routing rules to include
Host()component if that was configured inJupyterHub.bind_url, insteadHostrule is only included when jupyterhub runs with host based routing.If
bind_url="https://example.com", I expect dynamic routing rules to beActual behaviour
generated dynamic routing rules only include
PathPrefixandPathrules. Confirmed by code inspection here:traefik-proxy/jupyterhub_traefik_proxy/traefik_utils.py
Lines 44 to 64 in 9dcc5b6
I think
generate_rulefunction should takehostargument extracted from.public_urlconfiguration and if that is not empty include it in the rule.How to reproduce
Your personal set up
Full environment
Configuration
# jupyterhub_config.pyLogs