RabbitMQ MQTT over Websockets with IIS as reverse proxy error

805 views
Skip to first unread message

giannis partheniades

unread,
Dec 29, 2021, 7:31:04 PM12/29/21
to rabbitmq-users
Hi, I am using RabbitMQ Windows with IIS (ARR and Websockets installed) as reverse Websocket proxy.
The Paho Java client, that also functions with Websocket backend, successfully connects via IIS to the backend Websocket port (15675)  and receives messages from this setup.
However, with the Paho Javascript client, socket connection closes immediately after it is established.
When I connect to the broker directly without using IIS as reverse proxy, everything works as expected with both Java and Javascript clients.
Has anyone else encountered this requirement (IIS at the front) and faced this problem?
Any help will be appreciated, as I am forced to use IIS for all types of incoming connections.


Wes Peng

unread,
Dec 29, 2021, 8:02:02 PM12/29/21
to rabbitm...@googlegroups.com
Reverse procy should use consistent hashing for balancing the requests. Should setup the options for TCP long connection too.


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/9ade96b1-4090-46fc-bea7-e88c61941b46n%40googlegroups.com.

giannis partheniades

unread,
Dec 30, 2021, 5:39:01 AM12/30/21
to rabbitm...@googlegroups.com
Thank you,
Till now I had been using HAProxy and everything worked like a charm. Do you know how I can achieve these with IIS?

Wes Peng

unread,
Dec 30, 2021, 5:45:06 AM12/30/21
to rabbitm...@googlegroups.com
Hello 

I know reverse proxy well. Once I published a book about Squid Proxy. I have zero experience on IIS. But for their theory I think both are the same.

Regards 

giannis partheniades

unread,
Jan 4, 2022, 4:54:43 AM1/4/22
to rabbitm...@googlegroups.com
I got it to work. If anyone else faces the problem of having to cope with IIS as a reverse proxy for RabbitMQ Web MQTT, do the following:

1. Get and install ARR (Application Request Routing) from Microsoft. It also installs URL Rewrite Module 2.0 if not already there
2. In ARR settings, check "Enable proxy"
3. Create an empty IIS site with binding to the desired port (e.g. 443)
4. Create a Rewrite Rule for the site that will point to the IP address/port where the web mqtt plugin listens
5. Now comes the tricky part: in that rewrite rule, change the value of SEC_WEBSOCKET_EXTENSIONS header which is placed by the browser WebSocket. With other WebSocket servers, it is suggested to set this value to "" (empty). With RabbitMQ web mqtt, this will not work. Instead, set the value to something meaningless for the web socket server, like "-"

I am also attaching an example of my web.config file that is created in the root directory of the site when the above rule is entered, copy that in the site root physical directory and you can skip steps 4. and 5.

After that, you can configure SSL on the site as per Microsoft's usual instructions so that IIS does the SSL offloading for the broker.


example_web.config
Reply all
Reply to author
Forward
0 new messages