Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix domain socket #933

Open
FallingSnow opened this issue Oct 12, 2022 · 6 comments
Open

Unix domain socket #933

FallingSnow opened this issue Oct 12, 2022 · 6 comments

Comments

@FallingSnow
Copy link

I have a proxy in front of miniserve. I was hoping I can pass through the requests/responses via a domain socket but I only see a -p port option.

Can miniserve listen on a domain socket?

@svenstaro
Copy link
Owner

Seems like a good idea. Probably should be an argument to -p. Should be easy to implement. Wanna take a stab at this?

@FallingSnow
Copy link
Author

Sure. You thinking something like miniserve -p 8080 and miniserve -p /tmp/web.socket both being valid?

Or do you want something like miniserve -p 8080 and miniserve -p unix:///tmp/web.socket?

@svenstaro
Copy link
Owner

I think probably the first one. The most important thing here is to check that the file doesn't already exist so that users don't accidentally nuke their own files. Apart from that, it should be pretty straight forward.

@FallingSnow
Copy link
Author

Are you okay with using miniserve -i /tmp/web.socket (--interfaces flag instead)? I think it might be more appropriate and it fits the code better.

@svenstaro
Copy link
Owner

svenstaro commented Oct 14, 2022

Oh yeah that might work as well. I think technically speaking it's a bit less correct. Perhaps it might be less confusing to have a different flag altogether, like --socket, -s? Perhaps we could also combine -i and -p into --socket to support stuff like -s 127.0.0.1:8080 -s /tmp/web.socket -s 0.0.0.0:8000. Currently we do not support listening on multiple different ports which might be cool?

EDIT: Might also be cool to support shortcuts this way: -s 127.0.0.1 would use the default port 8080 and -s :8080 would use the default interface 0.0.0.0.

Let's have a short discussion here as it'll be a major change. :)

@FallingSnow
Copy link
Author

I think #935 is about as much time as I can invest right now. Please let me know what you think.

EDIT: Might also be cool to support shortcuts this way: -s 127.0.0.1 would use the default port 8080 and -s :8080 would use the default interface 0.0.0.0.

That would be cool but I am a little concerned as it requires you to learn an (albeit simple) syntax to listen on an ip and port.
-i 0.0.0.0 -p 80 is very intuitive to me vs -s :80 less so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants