summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 4818e70..c23bc75 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -38,6 +38,10 @@ char *cgit_hosturl()
{
char *host, *port;
+ host = getenv("HTTP_HOST");
+ if (host) {
+ host = xstrdup(host);
+ } else {
host = getenv("SERVER_NAME");
if (!host)
return NULL;
@@ -46,6 +50,7 @@ char *cgit_hosturl()
host = xstrdup(fmt("%s:%d", host, atoi(port)));
else
host = xstrdup(host);
+ }
return host;
}