Socketio path handling fails in specific reverse proxy setups.
The issue involves incorrect socketio path handling in edge cases, particularly with reverse proxy setups. The path incorrectly includes port numbers and site names, which should be dynamically adjusted or configurable. The fix requires understanding of both the socketio client code and reverse proxy configurations.
this issue is related to this: https://github.com/frappe/frappe_docker/issues/1481 https://github.com/frappe/frappe_docker/issues/1783 https://github.com/frappe/frappe/issues/33159 https://github.com/frappe/frappe/issues/32436 https://github.com/frappe/frappe/issues/32436#issue-3043489310
Context:
To reproduce:
after some debugging i got it working. so here i am just reporting it
refering to this code: https://github.com/frappe/frappe/blob/35c1cc0276f5849325a9370327a31762f920eb51/frappe/public/js/frappe/socketio_client.js#L116C1-L127C3
in my case this specific function returns
subdomain.mysite.com:9000/sitename.com/socket.io/
when i was expecting
subdomain.mysite.com/socket.io/
so 2 problem:
below is the way i adjust it to work i need it to return host instead of host/sitename.com which is some random site i chose when creating bench new-site
i understand that the existing code is tring to cater the needs of multitenancy, but i think instead of assuming right away that the site is mutitenant with /sitename.com as path, perhaps there might be ways to dynamically autoadjust it or configure it maybe in common_site_config or smth? eg : socketio_path :"/" or "/{}"
in my case i did it like so:
get_host(port = 9000) {
let host = window.location.origin;
// somehow changing developer_mode 1 doesnt cause this windows.dev_server to change to false
// causing the site to return <sitename>:<port>
// dev_server originally indicates development vs production build mode,
// but netwo
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!