nchan icon indicating copy to clipboard operation
nchan copied to clipboard

Multisub request gets 403 for multipub'ed channels

Open yerkanian opened this issue 5 years ago • 2 comments

Hello,

Is this by design or the configuration is missing something? Is nchan_subscribe_existing_channels_only compatible with channel multiplexing?

location ~ /multisub-split/(.*)$ { nchan_subscriber; nchan_channel_id "$1"; nchan_channel_id_split_delimiter ","; nchan_subscribe_existing_channels_only on; }

location ~ /multipub/(\w+)/(\w+)$ { nchan_publisher; nchan_channel_id "$1" "$2"; }

$ curl -v -X POST -d 'test' -H 'Accept: text/json' https://server/multipub/a/b < HTTP/1.1 202 Accepted {"messages": 1, "requested": -1, "subscribers": 0, "last_message_id": "0"}

$ curl -v -H 'Accept: text/event-stream' https://server/multisub-split/a,b < HTTP/1.1 403 Forbidden

Subscribing to a single channel does work and receives the message published with the multipub: $ curl -v -H 'Accept: text/event-stream' https://server/multisub-split/a < HTTP/1.1 200 OK : hi

id: 1581066231:0 data: test

yerkanian avatar Feb 07 '20 09:02 yerkanian

In this case, the subscribe request will succeed only if that particular multiplexing of channels has been accessed before. It doesn't check if all the individual channels exist. This is not the behavior a user would expect, and I may want to change this in the near future.

slact avatar Mar 10 '20 23:03 slact

Could you please elaborate on channels being "accessed before"? In my example above, the same multiplexing of channels a and b is being pub-ed by a POST, yet the following multi-sub fails. Shouldn't it have been successful by the logic, as both channel did exist by then?

yerkanian avatar Mar 11 '20 08:03 yerkanian