commit 4a0075084de92d34b83a88b2bcd69568c7b2bf7e
parent 089e995b319e238c79d25c61b0c7036c7e83539d
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 26 Oct 2023 15:24:50 -0300
use x-forward-port in case base url is not on standard port
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
@@ -742,6 +742,7 @@ TMH_base_url_by_connection (struct MHD_Connection *connection,
{
const char *host;
const char *forwarded_host;
+ const char *forwarded_port;
const char *uri_path;
memset (buf,
@@ -773,6 +774,16 @@ TMH_base_url_by_connection (struct MHD_Connection *connection,
GNUNET_buffer_write_str (buf,
host);
}
+ forwarded_port = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "X-Forwarded-Port");
+ if (NULL != forwarded_port)
+ {
+ GNUNET_buffer_write_str (buf,
+ ":");
+ GNUNET_buffer_write_str (buf,
+ forwarded_port);
+ }
uri_path = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Prefix");
@@ -799,6 +810,7 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
{
const char *host;
const char *forwarded_host;
+ const char *forwarded_port;
const char *uri_path;
memset (buf,
@@ -810,6 +822,9 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
forwarded_host = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Host");
+ forwarded_port = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "X-Forwarded-Port");
uri_path = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
"X-Forwarded-Prefix");
@@ -833,6 +848,13 @@ TMH_taler_uri_by_connection (struct MHD_Connection *connection,
"/");
GNUNET_buffer_write_str (buf,
host);
+ if (NULL != forwarded_port)
+ {
+ GNUNET_buffer_write_str (buf,
+ ":");
+ GNUNET_buffer_write_str (buf,
+ forwarded_port);
+ }
if (NULL != uri_path)
GNUNET_buffer_write_path (buf,
uri_path);