Add protocol to proxy file format (may remove), misc changes

This commit is contained in:
Book-reader 2025-09-05 15:44:29 +12:00
parent c39a425d48
commit f11aa99038
3 changed files with 20 additions and 6 deletions

View file

@ -1,4 +1,4 @@
http://127.0.0.1:8001 {
http://127.0.0.1:1235 {
route /static/* {
uri strip_prefix /static
file_server {
@ -6,10 +6,10 @@ http://127.0.0.1:8001 {
}
}
reverse_proxy 127.0.0.1:5843
reverse_proxy http://auth-frontend:5843
}
http://127.0.0.1:8002 {
http://127.0.0.1:1234 {
route /static/* {
uri strip_prefix /static
file_server {
@ -17,5 +17,5 @@ http://127.0.0.1:8002 {
}
}
reverse_proxy 127.0.0.1:5842
reverse_proxy http://frontend:5842
}

View file

@ -30,6 +30,7 @@ impl FromStr for Proxy {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut parts = s.split(':');
let protocol = parts.next().ok_or(ProxyError::InvalidProxyFormat)?;
let host = parts.next().ok_or(ProxyError::InvalidProxyFormat)?;
let port = parts.next().ok_or(ProxyError::InvalidProxyFormat)?;
let auth = if let Some(user) = parts.next() {
@ -39,7 +40,7 @@ impl FromStr for Proxy {
None
};
Ok(Proxy {
address: format!("{}:{}", host, port),
address: format!("{}://{}:{}", protocol, host, port),
credentials: auth,
})
}

View file

@ -105,6 +105,19 @@ services:
ports:
- "1234:80"
- "1235:81"
# caddy:
# image: caddy:latest
# networks:
# - lyphenet
# - outer
# depends_on:
# - frontend
# - auth-frontend
# volumes:
# - ./Caddyfile:/etc/caddy/Caddyfile
# ports:
# - 1234:1234
# - 1235:1235
networks:
outer: