I am trying to understand how works the message-bus feature used by discourse to stay online with new messages and events. Specifically I am insterested in how is used in the recent Discourse chat plugin.
Making some reverse ingeniering I see that when I enter to chatroom, everytime the message-bus make a poll via “https://mysite.com/message-bus/client_id/poll” then the request headers are duplicated for example:
So that works into my site but when I try to make a request from an external site or mobile app, then I get the error:
Access to XMLHttpRequest at 'https://forum-dev.srepe.com/message-bus/f6e2303ff7704f608ef2b821fe210e90/poll'
from origin 'http://localhost:8100' has been blocked by CORS policy:
The 'Access-Control-Allow-Origin' header contains multiple values
'https://forum-dev.srepe.com, *', but only one is allowed.
So, if I understand the message_bus set their own “Headers” ? There are any way to use the “Headers” already set by the config of Discourse, at least those with CORS behaviour ?
I seek to avoid duplicate “headers” when using message_bus. This allow me to make request outside the forum site
I am afraid this is all too custom for me to provide advice here, totally appreciate more people using message bus, but you you are going to have to debug through things here.