Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app can only be served from the root path #8

Open
pmeier opened this issue May 16, 2024 · 0 comments · May be fixed by #10
Open

app can only be served from the root path #8

pmeier opened this issue May 16, 2024 · 0 comments · May be fixed by #10
Assignees

Comments

@pmeier
Copy link
Collaborator

pmeier commented May 16, 2024

Running uvicorn test:app works fine. This serves the app at the root path, i.e. http://127.0.0.1:8000.

When trying to serve anywhere else, e.g. by doing

diff --git a/test.py b/test.py
index 8efa324..a6b4d70 100644
--- a/test.py
+++ b/test.py
@@ -37,7 +37,7 @@ def panel_app(doc):
 handler = FunctionHandler(panel_app)
 application = Application(handler)
 
-app = BokehFastAPI(application).server
+app = BokehFastAPI({"/foo": application}).server
 
 
 @app.get(f"/{COMPONENT_PATH.rstrip('/')}" + "/{path:path}")

the websocket connection is refused:

❯ uvicorn test:app
INFO:     Started server process [40277]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:41738 - "GET /foo HTTP/1.1" 200 OK
INFO:     127.0.0.1:41738 - "GET /static/js/bokeh.min.js?v=887e6bace8d80f5c1555c1913f730061c2d73acb83adb7f4ccf2ef02ffc7e5e864f7b1c97db9a4f6643a1431700d65e2686759f5c4bb1ac92631e8b659ceead3 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60760 - "GET /static/js/bokeh-gl.min.js?v=16b01ef75f511f8f198a5482526dda37a8dd2890780e67cfac172b1f7444025a816e31ebaf03be07bd1f1be7530357f039deae1e67bf13e34c7d8621070b9a40 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60788 - "GET /static/extensions/panel/panel.min.js?v=887ec9b15fed2e607213f962c1359031b26af977f91d38dcf009d808f06fe7d7 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60774 - "GET /static/js/bokeh-tables.min.js?v=4ef7c086bf94cc39a83637c54054e783a9c9a0b096d50cf18dce79912cfa413a8b9d4c4a7846124cb93b4fe00ea8007ae98213ba56bd731d081989ac1c17dd81 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60798 - "GET /static/extensions/panel/css/loadingspinner.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60764 - "GET /static/js/bokeh-widgets.min.js?v=896b45817f242212a2758406f43054652a991a1255bba2fdd808e728c9e0bde29c2b7320602f2c24238021e8726d2385b56cf20b60223d610e1cfffad9655cd8 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60798 - "GET /static/extensions/panel/css/listpanel.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60764 - "GET /static/extensions/panel/css/json.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60760 - "GET /static/extensions/panel/css/markdown.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60774 - "GET /static/extensions/panel/css/loading.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60764 - "GET /static/extensions/panel/bundled/theme/default.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60798 - "GET /static/extensions/panel/bundled/material-components-web%407.0.0/dist/material-components-web.min.css HTTP/1.1" 200 OK
INFO:     127.0.0.1:60760 - "GET /static/extensions/panel/bundled/material-components-web%407.0.0/dist/material-components-web.min.js HTTP/1.1" 200 OK
INFO:     127.0.0.1:60774 - "GET /static/extensions/panel/bundled/theme/material_variables.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     127.0.0.1:60788 - "GET /static/extensions/panel/bundled/materialtemplate/material.css?v=1.5.0-a.2 HTTP/1.1" 200 OK
INFO:     ('127.0.0.1', 60808) - "WebSocket /foo/ws" 403
INFO:     connection rejected (403 Forbidden)
INFO:     connection closed
INFO:     127.0.0.1:41738 - "GET /static/extensions/panel/images/apple-touch-icon.png HTTP/1.1" 200 OK
INFO:     127.0.0.1:60788 - "GET /static/extensions/panel/images/favicon.ico HTTP/1.1" 200 OK
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [40277]

Aborted!

In the logs above everything is ok besides

INFO:     ('127.0.0.1', 60808) - "WebSocket /foo/ws" 403
INFO:     connection rejected (403 Forbidden)
INFO:     connection closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants