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

Allow custom host to bind to #28

Open
catthehacker opened this issue Nov 9, 2020 · 2 comments
Open

Allow custom host to bind to #28

catthehacker opened this issue Nov 9, 2020 · 2 comments

Comments

@catthehacker
Copy link

catthehacker commented Nov 9, 2020

This allows for filite to work in edge(?) cases where binding to localhost is not enough.
Binding to localhost or 127.0.0.1 allows the app to be accessible only by the host itself and with sandboxed network configuration this makes it impossible to have it accessible in certain setups.
I've made quick change to current source to allow it but I'm not good at Rust.
https://github.com/CatTheHacker/filite/commit/df89d52ae8fd513f4442d849e87bb7bfc1502fd6

Also in case of using reverse proxy in front of filite, it would be nice to have an option to use UNIX sockets to bypass network completely

diff --git a/src/main.rs b/src/main.rs
index 62cfd45..245d5e9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -95,7 +95,7 @@ async fn main() {
                     .route(web::delete().to(routes::texts::delete)),
             )
     })
-    .bind(&format!("{}:{}", host, port))
+    .bind_uds("/path/cat/.local/tmp/filite.sock")
     .unwrap_or_else(|e| {
         eprintln!("Can't bind webserver to specified port: {}", e);
         process::exit(1);

Nginx:

proxy_pass http://unix:/path/cat/.local/tmp/filite.sock:/
@raftario
Copy link
Owner

raftario commented Nov 9, 2020

Pretty sure that's configurable on the next branch but I'll double check. I'll also add unix socket support there, thanks for the suggestion. I don't plan on making any improvements to master myself since next is a complete rewrite and will replace it soon-ish (hopefully, but I haven't got a whole lot of free time to put in it at the moment), but if you open a PR I'll merge it.

@ghost
Copy link

ghost commented May 24, 2022

Any news here?

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