summaryrefslogtreecommitdiff
path: root/src/web.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2026-02-21 18:49:18 +0100
committerJesper Jensen <jesper@jnsn.dev>2026-02-21 18:49:18 +0100
commit983074cc8724f690948355d8962466d5b6cacb00 (patch)
treec1aae17d8b32a865d7a6dff9c58caf9216b882fa /src/web.c
parent9cb59aa6fd10b809d6a3bce8bd7d0b87f1684bea (diff)
Add the protocol to the curl example
Diffstat (limited to 'src/web.c')
-rw-r--r--src/web.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/web.c b/src/web.c
index 9c0789b..e85abaa 100644
--- a/src/web.c
+++ b/src/web.c
@@ -144,7 +144,10 @@ static enum MHD_Result handler(
*ptr = request;
request->server = server;
+ // @COMPL: The proxy might rewrite this, and we should support that
request->host = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, "Host");
+ // @COMPL: There are other headers we should look into
+ request->proto = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, "X-Forwarded-Proto");
if(strcmp(method, "POST") == 0) {
if(strcmp(url, "/clients") == 0 || strcmp(url, "/clients/delete") == 0 || strcmp(url, "/login") == 0) {
@@ -518,7 +521,7 @@ static enum MHD_Result handler(
// Render HTML
size_t html_len;
- char *html = html_render_client_detail_page(request->host, &client_result, backups_result, &html_len);
+ char *html = html_render_client_detail_page(request->host, request->proto, &client_result, backups_result, &html_len);
free(backups_result);
if (!html) {