I’m trying to set up TLJH as a folder on an existing webserver. My desired behavior is the following:
I’ve tried configuring TLJH through tljh-config
to no avail. At the moment, I have Apache accepting traffic over port 80. site1 is working fine, but when I try to go to example.org/jupyter, I get redirect to example.org/hub/jupyter/ and get a 404 error.
The output of tljh-config show
is:
users:
admin:
- hcchem3d
user_environment:
default_app: jupyterlab
http:
port: 8080
https:
port: 8443
c:
HubAuth:
hub_prefix: jhub
JupyterHub:
bind_url: http://:15001/jupyter/
My Apache configuration for Jupiter is:
<VirtualHost *:80>
RedirectMatch ^/jupyter(()|/)$ /jupyter/
ProxyRequests on
<Location "/jupyter/">
# Preserve Host header to avoid cross-origin problems
ProxyPreserveHost on
# Proxy to JupyterHub
ProxyPass http://localhost:8080/jupyter/
ProxyPassReverse http://localhost:8080/jupyter/
</Location>
</VirtualHost>
I can’t figure out where the redirection is occurring from /jupyter -> /hub/jupyter/. None of the instructions for base installs of JupyterHub are helping, I assume because Traefik is doing some work in the middle of this process. Is there a way to get this to work within the TLJH ecosystem?
I’ve given up on configuring Apache as the web-facing configuration. Now, I have Apache set to listen on port 8080. I configured the rules.toml
file with the following
[frontends]
[frontends.default]
backend = "backend__2F"
passHostHeader = true
priority = 100
[frontends.default.routes.test]
rule = "Path:/;AddPrefix:/hub"
data = "{\"hub\": true}"
[frontends.frontend__2F]
backend = "backend__2F"
passHostHeader = true
priority = 90
[frontends.frontend__2F.routes.rule1]
rule = "PathPrefix:/hub"
[frontends.webmo]
backend = "webmo"
passHostHeader = true
priority = 80
[frontends.webmo.routes.rule1]
rule = "PathPrefix:/webmo"
[backends]
[backends.backend__2F]
[backends.backend__2F.servers.server1]
url = "http://127.0.0.1:15001"
[backends.webmo]
[backends.webmo.servers.apache2]
url = "http://localhost:8080"
Using this, I’m able to navigate to the WebMO login page, but only if I explicitly type the port in the address bar… which means I have to open port 8080 in the Google Cloud firewall. What am I missing in this setup to push example.com/webmo
to automatically redirect to port 8080?
The output of wget localhost/webmo
is
--2020-03-31 20:00:02-- http://localhost/webmo
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/~webmo/cgi-bin/webmo/login.cgi [following]
--2020-03-31 20:00:02-- http://localhost/~webmo/cgi-bin/webmo/login.cgi
Reusing existing connection to localhost:80.
HTTP request sent, awaiting response... 404 Not Found
2020-03-31 20:00:02 ERROR 404: Not Found.
Changing it to wget localhost:8080/webmo
results in
--2020-03-31 20:00:10-- http://localhost:8080/webmo
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost:8080/~webmo/cgi-bin/webmo/login.cgi [following]
--2020-03-31 20:00:10-- http://localhost:8080/~webmo/cgi-bin/webmo/login.cgi
Reusing existing connection to localhost:8080.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
webmo: Permission denied
This is fine, as the login page wants a username and password.
Additionally, every time I reload TLJH, the rules.toml
file is rewritten… how do I add my modifications to the configuration for this file?
To summarize: how can I automate the Traefik redirection of localhost/webmo to localhost:8080/webmo, and how can I configure changes to the file rules.toml
?