Mathics icon indicating copy to clipboard operation
Mathics copied to clipboard

Set base_url for mathicsserver ?

Open Carreau opened this issue 5 years ago • 4 comments

Is it possible to set the base url for mathics server ? I'd like to run it behind a reverse-proxy and can't expose it at the root of the domain. This seem to trigger issues with wrong URLs being requested.

II manage to have it to work locally by modifying the source and adding /base_url/ in many places, but I'm tempted to think there is a better way, but I'm unfamiliar with django. Pointers would be welcomed.

I'm guessing the following is possible. a {{base_url}} in templates, some way to automagically prepend something to all the django routes. And add a base-url attribute to the html body that can be accessed from within javascript to avoid having to template the javascript.

Much appreciated; with pointer and if you would be willing to accept such a PR, I could spend a couple of hours on it.

Carreau avatar Mar 08 '19 16:03 Carreau

I have exactly the same issue with making the Mathics server available on https://CoCalc.com. Right now we have 2-click launchers for Jupyter classic, JupyterLab, VS Code, and Pluto, and it would be nice to add Mathics:

image

williamstein avatar Sep 14 '21 18:09 williamstein

We need either base_url support or for all request paths to be relative url's. Right now Jupyter classic and Lab have very good base_url support, and vscode and Pluto both only use relative url's. Either solution would be fine for us...

williamstein avatar Sep 14 '21 18:09 williamstein

Personally, I'll be out of contact for the next week or so. If @Carreau or @williamstein you can put in in PR that would definitely speed things up. (I am not sure any of us have that much experience with Django.)

BTW the PR would be made nowadays against https://github.com/Mathics3/mathics-django since that is where Django-related stuff occurs. (mathicsserver is installed there now.)

This repository is pretty much frozen by the folks that do all of the commits nowadays. The new repository for the "core" part (builtin functions without front ends or specialized backend rendering) is now https://github.com/Mathics3/mathics-core

In a couple of weeks we'll probably have a release of what we have using that instead of this repository.

rocky avatar Sep 14 '21 18:09 rocky

See https://stackoverflow.com/questions/17420478/how-to-set-base-url-in-django

rocky avatar Sep 14 '21 19:09 rocky