traefik-proxy icon indicating copy to clipboard operation
traefik-proxy copied to clipboard

Host component of `bind_url` should be used in dynamic rules but isn't

Open Kirill888 opened this issue 1 year ago • 1 comments

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:

https://github.com/jupyterhub/traefik-proxy/blob/9dcc5b69e04eb6cb3730f6ff664cad4cd7d8badd/jupyterhub_traefik_proxy/traefik_utils.py#L44-L64

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

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Your personal set up

  • OS:
  • Version(s):
Full environment
# paste output of `pip freeze` or `conda list` here
Configuration
# jupyterhub_config.py
Logs

Kirill888 avatar Jul 07 '23 05:07 Kirill888

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Jul 07 '23 05:07 welcome[bot]