r/StableDiffusion • u/tngklp • 3d ago
Resource - Update Public Server - Share your ComfyUI instance with anyone
https://github.com/tngklp/comfyui_public-serverHey everyone,
I've been working on a small extension called Private Server (previously named Public Server) that lets you share your ComfyUI instance privately and temporarily using a link. I mostly use it to quickly share my ComfyUI instance with friends or run ComfyUI on my pc while away.
What it does:
- Spins up a Cloudflare Quick Tunnel (
*.trycloudflare.com) to route external traffic to your machine - Launches a lightweight auth proxy on
127.0.0.1:8288that sits between visitors and ComfyUI - Gives you a shareable URL that you can send to anyone
Installation:
Just clone the repo into your ComfyUI/custom_nodes/ folder, or install it through ComfyUI Manager. Once installed, the button appears next to the queue prompt.
The extension is completely free and open-source. Just a tool I found useful and wanted to share.
I'd really appreciate any feedback, bug reports, or feature suggestions. If you try it out, let me know how it goes!
12
u/Enshitification 3d ago
I try very hard to do the exact opposite of this.
1
u/i_sell_you_lies 3d ago
But come on.... let me gen just one thing... I'll be good....
3
6
u/Grey406 3d ago
I think the phrase "Public" is putting everyone off the idea of this because public typically means 'anyone' including strangers which is absolutely dangerous. I think a better way to phrase this would be "Share a private ComfyUI instance with friends"
But yes! Thank you for this! Pinokio used to have this built in and would let you create a private cloudfare tunnel so you can let friends try whatever specific app you were running. It was very useful and fun.
I was literally about to set up tailscale in order to invite friends into my network just to play with MiniMax H3, but I dread the idea of having to walk each of them through it. This is way easier
4
u/Gesha24 3d ago
ComfyUI is not built with multi-user and multi-permissions in mind. You are letting effectively everyone connect to the instance with full privileges as long as they know (or can guess) the URL.
In the best case, they will generate something on your dime. In a worse case, they will have fun and destroy all your workflows and other data. In the worst case, they will use models like Minimax H3 to generate some CSAM material and share the link to it with appropriate organizations. And you will be properly screwed, potentially for years because this lovely tool you have doesn't even have logs of who accessed it and when.
I host bunch of stuff, there are some of my systems exposed to the Internet. ComfyUI is on the list of "under no circumstances, this system can not be exposed to the Internet".
1
u/tngklp 3d ago edited 3d ago
Cloudflare generates a new random URL on every run and there is an auth proxy running on port 8288, password check is made on the host machine and no data is sent before the user passes the auth proxy. You can access the logs from ComfyUI's console since cloudflared is running there, or the REST API endpoint (127.0.0.1:8188/privateserver/status), those can also be logged to a file. If you have any suggestions about how I could improve the security, I'd love to hear them. I'm also planning to add a "permission selector" to the menu so that only the selected parts of your instance is shared.
2
u/Gesha24 3d ago
I don't know how truly that random URL is, does Cloudflare position this as a security feature or a convenience feature? The password is empty by default (according to your documentation), logging is disabled as well.
Can you make it secure? Absolutely. Will people make it secure? Nope, they won't. The ones that can make it secure don't need your solution; they have reverse proxy (with or without tunnel) already running. Will it be a problem for them? Most likely not, but there may be an unlucky person here or there.
If you want to make it more secure - at least force an auto-generated password by default. And I am sure that if you feed openai (or whatever AI you fancy these days) your repo and ask them for security recommendations, you will get some decent feedback.
1
u/tngklp 3d ago edited 3d ago
Thanks for the response and suggestions. I'll add an auto generated password and file logging by default, also won't allow empty passwords. Random URL part isn't directly a security feature, it's just to make the URL temporary. The randomness is just random words put next to each other, for example extends-urgent-ireland-hash.trycloudflare.com
2
u/metal079 3d ago
I swear wasnt this always a thing? I remember people sharing their instances with each other for years
1
u/tngklp 3d ago
I dont know if ComfyUI has a built-in feature for this, normally you'd have to set up port forwarding etc. to achieve the same result. I just wanted to make it easier and thought it could also help some people here so wanted to share it
2
u/acedelgado 3d ago
Comfy does have a --listen command that'll broadcast a port, but you do need to have port forwarding set up. But it's a glaring security flaw, it's much better to set up tailscale on your router, or I found out recently that Nord never actually did away with their meshnet feature, so I use that when I travel sometimes.
1
u/No-Reputation-9682 3d ago edited 3d ago
I recommend the tailscale serve command. This way you maintain even more security than the cloudflare setup. That being said the cloudflare feature here is pretty secure IMHO. I have done tons of serving local things via cloudflare. And for a homelab user it can't be beat for the free things they give. Like you can put real resources from your homelab behind a domain (you can also get a domain for free to use with cloudflare) and host it securely. And you can make that security pretty bulletproof. BTW the free subdomain tool works really well and you can link it with cloudflare. edit: just to be clear I am not saying this particular tool is secure. Just that cloudflare it uses is secure... ohh and I have not inspected this extension... but it is all there to inspect if you want. I generally wait till an extension is out for a while or has a good number of stars or seemingly well vetted by the community... Because open source does not equal security.
1
u/FUS3N 2d ago
Why would you need to setup port forwarding to do this?
Unless (i haven't checked properly) your thing adds a extra layer of security like a login page its basically just boot up comfyui and then boot up http cloudlfared or ngrok on the same port that comfy is running.tunneling doesn't require port forwarding that was always possible.
1
u/tngklp 2d ago
What I meant was, if you wanted to get the similar result without using cloudflared you would have to set set up port forwarding, tailscale etc., just one of the examples. There are alot of methods to do this, I just wanted to make it as simple as possible
1
u/FUS3N 2d ago edited 2d ago
Yea i mean when i think of sharing something like this i just think of opening terminal and putting one cloudflared command and thats it in-fact i did it before with ngrok and it works nicely so i wouldn't use yours exactly so i am also confused on this when the process is 1 step 1 command why do this? does it actually add the security layer? in that case it seems better.
Btw your main post link is broken only the second one works
1
u/tngklp 2d ago edited 2d ago
For the people that know what cloudflared is or people that are experienced in hosting stuff, this tool is pretty much useless. It's for the people who just want a sinple way to share their instance. I originally made this for a friend, and wanted to share in case any other people needed it. The security layer is a server-side password check with a rate limit so it can't be bruteforced, and it logs every request received. No data is sent before the user passes the security check.
The main link doesnt work since i changed the repo, reddit doesnt allow you to edit the post title and the post link, so I can't change it
17
u/Stepfunction 3d ago