aboutsummaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-10-28 21:40:54 +0200
committerChristian Grothoff <christian@grothoff.org>2023-10-28 21:40:54 +0200
commit9da968d394083339ce3125b4f619dfdf3e776ca9 (patch)
treead5418a6dac698cc24ea8215afe8e1a947056660 /src/backend/taler-merchant-httpd.c
parent2b694efd1542fd1b8415ebbb1ca2965711299eb0 (diff)
add new BASE_URL option (fixes #7966)
Diffstat (limited to 'src/backend/taler-merchant-httpd.c')
-rw-r--r--src/backend/taler-merchant-httpd.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index dd6e5a07..5a581928 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -118,6 +118,13 @@
char *TMH_currency;
/**
+ * What is the base URL for this merchant backend? NULL if it is not
+ * configured and is to be determined from HTTP headers (X-Forwarded-Host and
+ * X-Forwarded-Port and X-Forwarded-Prefix) of the reverse proxy.
+ */
+char *TMH_base_url;
+
+/**
* Inform the auditor for all deposit confirmations (global option)
*/
int TMH_force_audit;
@@ -153,7 +160,7 @@ unsigned int TMH_num_cspecs;
/**
* Rendering specs for currencies.
- */
+ */
struct TALER_CurrencySpecification *TMH_cspecs;
/**
@@ -2180,7 +2187,7 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
-
+
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"merchant",
@@ -2193,6 +2200,27 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "merchant",
+ "BASE_URL",
+ &TMH_base_url))
+ {
+ if ( (0 != strncasecmp (TMH_base_url,
+ "https://",
+ strlen ("https://"))) &&
+ (0 != strncasecmp (TMH_base_url,
+ "http://",
+ strlen ("http://"))) )
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ "merchant",
+ "BASE_URL",
+ "Needs to start with 'http://' or 'https://'");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ }
if (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (cfg,
"merchant",