Skip to content

Commit

Permalink
Fix "Show Logs" due to missing _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 535a990
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 535a990

Please sign in to comment.