Proxy problem with marimo

Hi,

I’m working on an interactive app for marimo and I almost have it working.

marimo seems to have good support for being proxied - marimo edit --help shows these flags:

  --proxy TEXT              Address of reverse proxy.
...
  --base-url TEXT           Base URL for the server. Should start with a /.
                            [default: ""]

Here is the relevant bit of my script.sh.erb:

#!/usr/bin/env bash
module purge

 
# TODO parameterize python module
module load fhPython uv


# Output debug info
module list


# TODO parameterize path to edit
mkdir -p ${HOME}/.marimo-notebooks

# TODO use a token
uvx --python $(which python) marimo edit --proxy \
  openondemand.fredhutch.org:443 --no-token --headless \
  --host 0.0.0.0 --port ${port} \
  --base-url /rnode/$(hostname)/${port} ${HOME}/.marimo-notebooks

marimo spits out (in output.log):


        Create or edit notebooks in your browser 📝

        ➜  URL: https://openondemand.fredhutch.org/rnode/gizmoj14/60263

So it seems like it totally understands proxying. Unfortunately when I go to that link, I get this:

That doesn’t actually look like an HTML page; it’s how the browser I use renders JSON files.

If I go to the browser’s dev tools I can see that a request to https://openondemand.fredhutch.org/rnode/gizmoj14/60263/ returned a 404. The response header also included a content type of application/json which is maybe why my browser is treating it as a json page.
Also, the response Server header is “uvicorn”, which is the server that marimo uses, so I have the empty satisfaction that at least I am talking to marimo even if I am not seeing what I want.

If I go directly to the node/port, with the base URL added in, I get what I expect/want, the marimo editing page:

http://gizmoj14:60263/rnode/gizmoj14/60263/

So while it seems like marimo knows how to be proxied, something isn’t working right.

What is going on and how can I troubleshoot this?

Thanks,
Dan

First I’ve seen Marimo, interesting app. Looks like this is just about there, I think all that you need to do is either adjust how the proxy is working or how you’re starting the app.

Here’s the docs page on the proxy which may help, with some explanation below:

When you use rnode_uri OOD will strip off the /<node_uri>/<host>/<port> prefix of that URL and change the Host to the <host>:<port>. Whereas if you use node_uri the full path will be used in the URI for the GET.

This means if we look at that --base-url /rnode/$(hostname)/$(port) ${HOME}/.marimo-notebooks that OOD is removing that whole /rnode/$(hostname)/$(port), and hence marimo expects /rnode/.. but that has been removed, and you get a 404 back.

It might be as simple as removing that --base-url line entirely, and given your confirmation of hitting that editing page it seems like this is the issue.

1 Like

Thanks for your reply.

I removed the --base-url flag and got an Apache 404 page.

I could get directly to the editing page with
http://nodename:port

However, I put the --base-url flag back in and changed rnode to node and now it works. Still testing but it appears to be working perfectly.

Thanks very much for the pointer to those docs.

Dan