Solara not respecting different root path

We have a Solara app which we'd like to exist at a specific URL, e.g. http://domain.com/solara-app. However, it doesn't seem like we can find the correct combination of SOLARA_ROOT_PATH, SOLARA_BASE_URL, or SOLARA_ORIGIN to get the app served at that location. Currently, when using SOLARA_ROOT_PATH and SOLAR_BASE_URL, attempting to access http://domain.com/solara-app yields a spinning loading icon and the following the console:
WebSocket connection to 'ws://localhost:8865/solara-app/jupyter/api/kernels/c24edfd8-d5c3-4c25-b9c0-8b1d0b49f2dd/channels?session_id=38c6874d-2fed-4d58-9211-80f5a3f33295' failed:
WebSocket connection to 'ws://localhost:8865/solara-app/jupyter/api/kernels/c24edfd8-d5c3-4c25-b9c0-8b1d0b49f2dd/channels?session_id=38c6874d-2fed-4d58-9211-80f5a3f33295' failed:
We have also tried attempting to mount the Solara app at the specified path in a Starlette server, which does seem to work except that our static asset files are no longer found, and the authentication through Solara Enterprise fails with Starlette complaining about missing middle ware. Any help would be appreciated.
6 Replies
mariobuikhuizen
mariobuikhuizen2mo ago
Hi Nicholas. Are you using solara>=1.38.0? It has a fix for SOLARA_BASE_URL in combination with auth: https://solara.dev/changelog/#version-1380
animusater
animusaterOP2mo ago
Hey Mario. Yeah, we're currently on 1.40 and are seeing this issue. Although, if you're referring to mounting no the Starlette app, we did seem to fix the middle ware issue. However, we cannot seem to get past a CSRF warning:
authlib.integrations.base_client.errors.MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response.
authlib.integrations.base_client.errors.MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response.
We had thought this may have to do with the secret_key passed to the session middleware, but we've tried using some random string, SOLARA_OAUTH_CLIENT_SECRET, and SOLARA_SESSION_SECRET_KEY, but it still seems to prevent using Solara Enterprise authentication correctly.
mariobuikhuizen
mariobuikhuizen2mo ago
Could you try removing the solara-session cookie in the browser? It can sometimes get in a state that also results in this error.
animusater
animusaterOP2mo ago
Unfortunately, this did not seem to be the issue. Also tried private mode, and different browsers, to no avail.
MaartenBreddels
Hi Nick, Can you try running with solara run ... --root-path=/solara-app ? And is there a proxy server running in front?
animusater
animusaterOP2w ago
Hey Maarten. Running with just solara run ... --root-path=/solara-app opens a window where the app is loaded at the base url, e.g. http://domain.com. If I then go to http://domain.com/solara-app, where the app should be mounted, I get forwarded to http://domain.com/solara-app/solara-app and the message Page not found by Solara router appears on the page. There is no proxy server running at the moment. This is completely local right now. Well, it seems I can resolve the authlib issue if I also include the middleware in the Startlette instantiation: app = Starlette(routes=routes, middleware=solara.server.starlette.middleware). However, I notice a few issues: 1. Our paths in the app are setup automatically based on the directory structure. However, when mounted to a different endpoint (e.g. /solara-app), the paths within the app still try to resolve http://domain.com. That is, if I go to the URL http://domain.com/solara-app, and then click the link to take me to Page1, the link does not point to http://domain.com/solara-app/page1, but instead http://domain.com/page1. Weirdly, this works. However, if you refresh the page, we get a Page not found by Solara router error. 2. Images, or custom static content, do not seem to work when the Solara app is not root. Images still try to get resolved to http://domain.com/static/public/image.png and not http://domain.com/solara-app/static/public/image.png. These issues persist even when using SOLARA_BASE_URL="http://domain.com/solara-app/" and SOLARA_ROOT_PATH="/solara-app". @MaartenBreddels @mariobuikhuizen Any thoughts on this?
Want results from more Discord servers?
Add your server