I wanted my laptop to be able to update sensors using Hass.agent via MQTT whenever I travel. I am sure there are other guides out there but I couldnt find them for 2 days and finally with brute force found my own way and writing this guide to help anyone else if someone stumbles upon the same problem.
Go to your cloudflare account and make a DNS record for your own domain. MAKE SURE YOU TURN OFF proxy. It should be DNS ONLY
Cloudflare allows the following ports ONLY. Please only choose a port out of them. I could only get 8080 to work for me.
I chose HTTP. You could choose HTTPS but it’s a few more hoops to jump through but is more secure. I leave that choice upto you.
Next goto your router and forward the port you chose, in my case, 8080, to where your Ngnix proxy manager lives. In my case 192.168.0.159. Make sure its TCP.
Goto NGNIX Proxy manager and goto streams not proxy
Create a new one. Forward the port you chose, in my case, 8080, to your homeassistant server, in my case, 192.168.0.181:1883. 1883 is the port on my MQTT broker for HTTP
Thats It. You should be able to put your DNS, in my case, emqx.mine.com and port 8080 to reach your MQTT broker at home.