# Login process does not complete with Content-Security-Policy

**URL:** <https://discourse.jupyter.org/t/login-process-does-not-complete-with-content-security-policy/5515>\
**Category:** JupyterHub\
**Tags:** jupyterhub\
**Created:** [August 6, 2020, 4:59am UTC](https://discourse.jupyter.org/t/login-process-does-not-complete-with-content-security-policy/5515 "2020-08-06T04:59:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcnyp](https://avatars.discourse-cdn.com/v4/letter/f/8dc957/32.png) [@fcnyp](https://discourse.jupyter.org/u/fcnyp)\
**Post date:** [August 6, 2020, 4:59am UTC](https://discourse.jupyter.org/t/login-process-does-not-complete-with-content-security-policy/5515/1 "2020-08-06T04:59:10Z")

</div>

Hope all is well! I am having issues setting up JupyterHub in an iframe. This was posted as a GitHub issue, per the guidance I am posting here for ideas/discussion =).

When I configure the ‘Content-Security-Policy’ setting the login process does not complete.

**How to reproduce:**  
1.) Set Content-Security-Policy in jupyterhub\_config.py

`c.JupyterHub.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors 10.200.50.3:80 "}}`

\*\*I have tried multiple variants of the Content-Security-Policy setting with the same results.

2.) Authenticate

**Expected Result:**  
Launch hub

**Result:**  
Redirected to login page

**Other:**

If I comment out c.JupyterHub.tornado\_settings I am redirected to hub after authentication as expected.

**Logs:**  
With c.JupyterHub.tornado\_settings enabled

```auto
[D 2020-08-05 21:54:16.821 JupyterHub base:522] Setting cookie jupyterhub-session-id: {'httponly': True}
[D 2020-08-05 21:54:16.822 JupyterHub base:526] Setting cookie for bob: jupyterhub-hub-login
[D 2020-08-05 21:54:16.822 JupyterHub base:522] Setting cookie jupyterhub-hub-login: {'httponly': True, 'path': '/hub/'}
[I 2020-08-05 21:54:16.822 JupyterHub base:707] User logged in: bob
[D 2020-08-05 21:54:16.822 JupyterHub user:242] Creating <class 'sudospawner.spawner.SudoSpawner'> for bob:
[I 2020-08-05 21:54:16.824 JupyterHub log:174] 302 POST /hub/login?next= -> /hub/spawn (bob@::ffff:10.200.50.2) 12.46ms
[I 2020-08-05 21:54:16.831 JupyterHub log:174] 302 GET /hub/spawn -> /hub/login?next=%2Fhub%2Fspawn (@::ffff:10.200.50.2) 0.93ms
[I 2020-08-05 21:54:16.841 JupyterHub log:174] 200 GET /hub/login?next=%2Fhub%2Fspawn (@::ffff:10.200.50.2) 1.19ms

```

With c.JupyterHub.tornado\_settings disabled

```auto
[I 2020-08-05 21:22:38.338 JupyterHub app:2631] JupyterHub is now running at http://:8000
[D 2020-08-05 21:22:38.339 JupyterHub app:2233] It took 1.251 seconds for the Hub to start
[I 2020-08-05 21:22:42.514 JupyterHub log:174] 302 GET / -> /hub/ (@::ffff:10.200.50.2) 1.13ms
[I 2020-08-05 21:22:42.521 JupyterHub log:174] 302 GET /hub/ -> /hub/login (@::ffff:10.200.50.2) 0.84ms
[I 2020-08-05 21:22:42.556 JupyterHub log:174] 200 GET /hub/login (@::ffff:10.200.50.2) 29.82ms
[D 2020-08-05 21:22:53.356 JupyterHub base:522] Setting cookie jupyterhub-session-id: {'httponly': True}
[D 2020-08-05 21:22:53.356 JupyterHub base:526] Setting cookie for bob: jupyterhub-hub-login
[D 2020-08-05 21:22:53.356 JupyterHub base:522] Setting cookie jupyterhub-hub-login: {'httponly': True, 'path': '/hub/'}
[I 2020-08-05 21:22:53.357 JupyterHub base:707] User logged in: bob
[D 2020-08-05 21:22:53.357 JupyterHub user:242] Creating <class 'sudospawner.spawner.SudoSpawner'> for bob:
[I 2020-08-05 21:22:53.363 JupyterHub log:174] 302 POST /hub/login?next= -> /hub/spawn (bob@::ffff:10.200.50.2) 14.58ms
[D 2020-08-05 21:22:53.385 JupyterHub pages:194] Triggering spawn with default options for bob
[D 2020-08-05 21:22:53.386 JupyterHub base:825] Initiating spawn for bob
[D 2020-08-05 21:22:53.386 JupyterHub base:829] 0/100 concurrent spawns
[D 2020-08-05 21:22:53.386 JupyterHub base:834] 0 active servers
[D 2020-08-05 21:22:53.445 JupyterHub user:556] Calling Spawner.start for bob

```

**System:**  
jupyterhub --version  
1.1.0  
Python 3.8.3
