Skip to content

Commit 9cc3bbb

Browse files
committed
Add xsrf_cookie_kwargs of tornado settings
1 parent 088c3f3 commit 9cc3bbb

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

jupyterhub/cwh-repo2docker/cwh_repo2docker/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,21 @@ async def _get_cmd_from_image(self):
213213
cmd = image_info["Config"]["Cmd"]
214214
return cmd
215215

216+
def get_args(self):
217+
args = super().get_args()
218+
username = self.user.name
219+
base_url = self.hub.base_url[:-4]
220+
xsrf_cookie_path = base_url + 'user/' + username + '/'
221+
# workaround when jupyterhub<=4.1.5 is used on single-user server
222+
# https://github.com/jupyterhub/jupyterhub/pull/4750
223+
# https://github.com/jupyterhub/jupyterhub/pull/4771
224+
args.append(
225+
'--ServerApp.tornado_settings='
226+
'{"xsrf_cookie_kwargs":{"path":"'
227+
+ xsrf_cookie_path + '"}}')
228+
229+
return args
230+
216231
async def get_command(self):
217232
image_cmd = await self._get_cmd_from_image()
218233
# override cmd for docker-stacks image

0 commit comments

Comments
 (0)