Skip to content

Commit c42f08a

Browse files
yamatonjtpio
andauthored
Resolve 'Show Logs' issue by adding _xsrf token in JupyterHub 4 (#61)
Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
1 parent 177f43f commit c42f08a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tljh_repo2docker/static/js/images.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ require([
128128
fitAddon.fit();
129129

130130
var logsUrl = utils.url_path_join(base_url, "api", "environments", image, "logs");
131+
if (api.xsrf_token) {
132+
// add xsrf token to url parameter
133+
var sep = logsUrl.indexOf("?") === -1 ? "?" : "&";
134+
logsUrl = logsUrl + sep + "_xsrf=" + api.xsrf_token;
135+
}
131136
eventSource = new EventSource(logsUrl);
132137
eventSource.onerror = function(err) {
133138
console.error("Failed to construct event stream", err);

0 commit comments

Comments
 (0)