Voila generates thousands of mathjax cdnjs.cloudflare.com requests

I have voila 0.5.8 installed in TLJH with just default configuration options. Upon issuing a voila render url to run a notebook, I get an error in the javascript console “Uncaught ReferenceError: MathJax is not defined”, followed by endless requests to “https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/latest.min.js?config=TeX-AMS_CHTML-full,Safe&delayStartupUntil=configured”, easily topping 100K requests in just a few minutes. All return status 200, but it keeps going.Eventually the browser becomes unresponsive, and the tab has to be closed. The notebook script runs fine.

Is this a known problem? Is there a configuration setting I can use to disable mathjax, or a way to set the url to my local server. Eventually this will have to run w/o internet. But, I don’t think internet access is the problem, as the request succeeds.

I have tried creating the file /etc/jupyter/voila_config.py with c.VoilaConfiguration.mathjax_url setting, but it has no effect. I have also modified the existing /opt/tljh/user/etc/jupyter/jupyter_notebook_config.d/voila.json file with the same setting, but it also has no effect.

“VoilaConfiguration”: {
“mathjax_url”: “localhost:8080”
},

Any help or guidance on where to look for a solution is appreciated.

I think this post is more relevant for JupyterLab category.

Seems like there has been a recent change in handling mathjax URL in voila. Maybe it is a regression. Please move it to JupyterLab so that maintainers can have a look at it!

1 Like

Thanks for the reply. I moved this to the JupyterLab category.

1 Like

Following up with my solution to the mathjax calls. Its a hack, but it solved the problem. The mathjax calls are embedded in the following files:

  • /opt/tljh/hub/share/jupyter/voila/templates/base/static/9212.voila.js
  • /opt/tljh/user/share/jupyter/voila/templates/base/static/9212.voila.js

I replaced the called to cloudflare mathjax with a call to a local static lib (jquery). The call was replaced with the following text:

i.PageConfig.setOption(e,"/hub/static/components/jquery/dist/jquery.min.js?=bf6089ed4698cb8270a8b0c8ad9508ff886a7a842278e98064d5c1790ca3a36d5d69d9f047ef196882554fc104da2c88eb5395f1ee8cf0f3f6ff8869408350fe")

We don’t use mathjax, so this fixes it for now.

1 Like