Skip to content

Commit

Permalink
tls_redirection_port feature
Browse files Browse the repository at this point in the history
fixes #178
  • Loading branch information
akostadinov committed Sep 3, 2024
1 parent f53a270 commit 3867ce6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
listen_port = 8080
listen_port_tls = 8443

# Optional. If you listen on a custom port like 8443 but redirect with firewall to 443
# tls_redirection_port = 443

# Optional for h2 and http1.1
tcp_listen_backlog = 1024

Expand Down
3 changes: 3 additions & 0 deletions rpxy-bin/src/config/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct ConfigToml {
pub listen_port: Option<u16>,
pub listen_port_tls: Option<u16>,
pub listen_ipv6: Option<bool>,
pub tls_redirection_port: Option<u16>,
pub tcp_listen_backlog: Option<u32>,
pub max_concurrent_streams: Option<u32>,
pub max_clients: Option<u32>,
Expand Down Expand Up @@ -107,6 +108,8 @@ impl TryInto<ProxyConfig> for &ConfigToml {
// listen port and socket
http_port: self.listen_port,
https_port: self.listen_port_tls,
https_redirection_port: if self.tls_redirection_port.is_some() {
self.tls_redirection_port } else { self.listen_port_tls },
..Default::default()
};
ensure!(
Expand Down
2 changes: 1 addition & 1 deletion rpxy-lib/src/message_handler/handler_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ where
"Redirect to secure connection: {}",
<&ServerName as TryInto<String>>::try_into(&backend_app.server_name).unwrap_or_default()
);
return secure_redirection_response(&backend_app.server_name, self.globals.proxy_config.https_port, &req);
return secure_redirection_response(&backend_app.server_name, self.globals.proxy_config.https_redirection_port, &req);
}

// Find reverse proxy for given path and choose one of upstream host
Expand Down

0 comments on commit 3867ce6

Please sign in to comment.