#13811·bokeh

[BUG] Bokeh doesn't support IPv6 websocket origins

Author: huaracheguaracheCreated Apr 6, 2024Updated Aug 15, 2026
Labelstype: featuretag: component: server

Software versions

Python version : 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0] IPython version : (not installed) Tornado version : 6.4 Bokeh version : 3.4.0 BokehJS static path : /var/home/michael/micromamba/envs/test_bokeh/lib/python3.12/site-packages/bokeh/server/static node.js version : (not installed) npm version : (not installed) jupyter_bokeh version : (not installed) Operating system : Linux-6.8.1-300.fc40.x86_64-x86_64-with-glibc2.39

Browser name and version

Firefox 124.0.1

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

Serving a Bokeh script with an IPv6 address in --allow-websocket-origin should allow you to connect over said IPv6 address.

Observed behavior

Adding attempting to do this with either [::1]:5006 or ::1:5006 results in an invalid host value error.

Example code

python
from bokeh.plotting import figure, show, curdoc

p = figure(width=400, height=400)

# add a line renderer
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)

curdoc().add_root(p)

Stack traceback or browser console output

Trying with [::1]:5006:

(test_bokeh) michael@localhost:~/src/koding/python/bokeh_ipv6_test$ bokeh serve --show main.py --allow-websocket-origin=[::1]:5006
/var/home/michael/micromamba/envs/test_bokeh/bin/bokeh:10: UserWarning: 
It looks like you might be running the main.py of a directory app directly.
If this is the case, to enable the features of directory style apps, you must
call "bokeh serve" on the directory instead. For example:

    bokeh serve my_app_dir/

If this is not the case, renaming main.py will suppress this warning.

  sys.exit(main())
2024-04-06 14:36:26,836 Starting Bokeh server version 3.4.0 (running on Tornado 6.4)
ERROR: Invalid host value: [::1]:5006

And with ::1:5006:

(test_bokeh) michael@localhost:~/src/koding/python/bokeh_ipv6_test$ bokeh serve --show main.py --allow-websocket-origin=::1:5006
/var/home/michael/micromamba/envs/test_bokeh/bin/bokeh:10: UserWarning: 
It looks like you might be running the main.py of a directory app directly.
If this is the case, to enable the features of directory style apps, you must
call "bokeh serve" on the directory instead. For example:

    bokeh serve my_app_dir/

If this is not the case, renaming main.py will suppress this warning.

  sys.exit(main())
2024-04-06 14:37:20,682 Starting Bokeh server version 3.4.0 (running on Tornado 6.4)
ERROR: Invalid host value: ::1:5006

Screenshots

No response