how to do reverse proxy on docker

后端 未结 1 1007
孤城傲影
孤城傲影 2021-01-28 21:38

I have a server and I am using Ubuntu 20.04, nginx , mosquitto and node-red and docker , let\'s call the website http://mywebsite.com. The problem that I am facing

相关标签:
1条回答
  • 2021-01-28 21:49

    OK, you are going to have several problems here.

    1. You can not do path based proxying with MQTT. If you want to have multiple MQTT brokers (1 per client) bound to a single public facing domain/IP address then they are all going to have to run on separate ports (other than the default 1883).

      Nginx can do MQTT protocol proxying (e.g. like this), so you can use this to expose the different ports and forward them to the separate instances of mosquitto, but even if you had a different hostname (all pointing at the same IP address) nginx has no way to know which host name was used because there is no equivalent to the HOST HTTP header to direct it. If you were to use MQTT with TLS then you may be able to get it to work with SNI, but I've never seen anybody do that yet (possible docs for SNI based routing here) It works, explanation about how to do it here.

      If you use MQTT over Websockets then you should be able to use hostname based routing.

    2. Path based proxying for Node-RED currently doesn't work properly if you enable admin authentication, because the admin auth tokens are currently stored in browser local storage and only scoped to the hostname, not the hostname + path. This will mean that a client will only ever be able to log into one instance at a time.

      You can work round this by using host based proxying, e.g. http://client1.mywebsite.com

      A fix for this is on the backlog for Node-RED, probably (no promises) to be looked at after version 1.2.0 ships

    0 讨论(0)
提交回复
热议问题