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

Jupyterhub - JupyterLab - Redirect loop detected #6079

Open
mehmetbebek opened this issue Mar 8, 2019 · 1 comment
Open

Jupyterhub - JupyterLab - Redirect loop detected #6079

mehmetbebek opened this issue Mar 8, 2019 · 1 comment
Milestone

Comments

@mehmetbebek
Copy link

I am trying to run jupyterlab from jupyterhub with below configs. Server is started but when I try to open user's notebooks it gives 500 Internal Server Error Infinite Loop

# Configuration file for jupyterhub.

import os
from jupyterhub.spawner import LocalProcessSpawner
from jupyter_client.localinterfaces import public_ips

c = get_config()

data_dir = '/etc/jupyterhub/data'
source_dir = '/etc/jupyterhub/notebooks'

class MySpawner(LocalProcessSpawner):

    def start(self):

        # Local vars
        username = self.user.name
        home_dir = '/home/%s/notebooks' %username
        cases_dir = home_dir+'/cases'
        examples_dir = home_dir+'/examples'
        workspace_dir = home_dir+'/workspace'

        # Home
        os.system("mkdir -p %s" %home_dir)

        # Welcome
        os.system("cp %s/Welcome.ipynb %s" %(source_dir,home_dir))

        # Examples
        os.system("rm -rf %s" %examples_dir)
        os.system("cp -r %s/examples %s" %(source_dir,home_dir))

        # Cases
        os.system("rm -rf %s" %cases_dir)
        os.system("cp -r %s/cases %s" %(source_dir,home_dir))

        # Workspace
        os.system("mkdir -p %s" %workspace_dir)
        os.system("cp -r %s/workspace-%s/. %s" %(data_dir,username,workspace_dir))
        os.system("chown -R %s %s" %(username,workspace_dir))
        return super().start()

    def stop(self):

        # Local vars
        username = self.user.name
        home_dir = '/home/%s/notebooks' %username
        workspace_dir = home_dir+'/workspace'

        # Backup workspace
        os.system("rsync -avz --delete %s %s/workspace-%s" %(workspace_dir,data_dir,username))
        return super().stop()

c.Authenticator.admin_users = set([])

c.JupyterHub.ip = public_ips()[0]
c.JupyterHub.port = 443
c.JupyterHub.admin_access = True
c.JupyterHub.cookie_secret_file = data_dir+'jupyterhub_cookie_secret'
c.JupyterHub.extra_log_file = '/var/log/jupyterhub.log'
c.JupyterHub.spawner_class = MySpawner
c.JupyterHub.hub_ip = public_ips()[0]
c.JupyterHub.hub_port = 1453

c.JupyterHub.services = [{'name': 'cull-idle',
                          'admin': True,
                          'command': 'python cull_idle_servers.py --timeout=3600'.split()}]
c.Spawner.debug = False
c.Spawner.notebook_dir = '/etc/jupyterhub/notebooks'
c.Spawner.args = ['--NotebookApp.default_url=%s/Welcome.ipynb' %source_dir]

c.LocalAuthenticator.create_system_users = True
c.Authenticator.whitelist = {'ttcdes', 'testuser'}
c.Authenticator.admin_users = {'ttcdes'}

c.Spawner.default_url = '/lab'
c.Spawner.cmd = ['jupyter-labhub']


[W 2019-03-08 15:09:16.929 JupyterHub web:1667] 500 GET /hub/user/ttcdes/?redirects=4 (10.166.22.236): Redirect loop detected.
[E 2019-03-08 15:09:16.931 JupyterHub log:150] {
      "Host": "10.166.22.236:1453",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://10.166.22.236:1453/hub/admin",
      "Cookie": "jupyterhub-hub-login=\"2|1:0|10:1552046661|20:jupyterhub-hub-login|44:MmVkODA1MDg0YThiNDhlODgzYjkxNTgyY2ExOTE3OWM=|052ad546c1c98a57b5ba891ebd31169cc02f1670eb831bad859f6bd9bd1f92bb\"; jupyterhub-session-id=c6f7036bcab04e02945fd222696c77ad",
      "Connection": "keep-alive",
      "Upgrade-Insecure-Requests": "1"
    }
@jasongrout
Copy link
Contributor

CC @yuvipanda @choldgraf - my guess is that this is a jupyterhub or configuration issue?

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

No branches or pull requests

2 participants