Skip to content

Commit

Permalink
Resolve 'Show Logs' issue by adding _xsrf token in JupyterHub 4
Browse files Browse the repository at this point in the history
  • Loading branch information
yamaton committed Nov 9, 2023
1 parent d711bda commit f3eaceb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tljh_repo2docker/static/js/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ require([
fitAddon.fit();

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

0 comments on commit f3eaceb

Please sign in to comment.