Daphne-Root-Path not taken in consideration in consumers URLs
See original GitHub issueDaphne does not seem to use the Daphne-Root-Path
when it computes the urls of the consumers.
I have:
Daphne-Root-Path
set toappname
- A web page at url
r"^home"
in myurls.py
- A consumer routed at
r"/ws/something"
in myrouting.py
And I observe that:
- My web page is served at address
/appname/home
which means that Daphne is using the root-path correctly. - The websocket is served at
/ws/something
and not at/appname/ws/something
which I would expect.
Indeed, if I look at the source, I can see that http_protocol.WebRequest
has a root_path
attribute which is used when a http answer is sent (here https://github.com/django/daphne/blob/1.3.0/daphne/http_protocol.py#L162) but there is nothing like this in ws_protocol.py
.
Is this actually a bug or am I missing something?
I tested this with Daphne 1.2.0 but it seems that the issue remains on the lastest version on the repository.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
daphne - Bountysource
Daphne does not seem to use the Daphne-Root-Path when it computes the urls of the consumers. I have: Daphne-Root-Path set to appname; A...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any updates?
Just to make my issue is related (please correct me if I’m wrong).
On localhost with runserver, I can reach the websocket connect function in my consumer with the following:
On my production environment, my nginx conf for the websocket proxy looks like this:
I then try to connect to
ws://myapp.com/<user_id>/
but the consumer connect never gets called. After changing the route to include the root path, everything appears to work as expected:If my issue is valid and related to this, what would be a suitable workaround ? I could easily create different routes to be used in development and production if needed.