From ffd0e8720a39a6d34843ffdd0a8b6fb91581087e Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 13 Feb 2019 19:13:22 +0100 Subject: [PATCH] pulsebert: let caddy accept any vhost, redirect to https://mpd.hq.c3d2.de Fixes Github issue #1 --- hosts/pulsebert/configuration.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hosts/pulsebert/configuration.nix b/hosts/pulsebert/configuration.nix index 8bc35a45..4669f866 100644 --- a/hosts/pulsebert/configuration.nix +++ b/hosts/pulsebert/configuration.nix @@ -4,7 +4,10 @@ { config, pkgs, ... }: -{ +let + ympdPort = 8080; + mpdVhost = "mpd.hq.c3d2.de"; +in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -176,8 +179,13 @@ agree = true; # TODO: add auth? config = '' - mpd.hq.c3d2.de - proxy / localhost:8080 + ${mpdVhost} { + proxy / localhost:${toString ympdPort} + } + + :80 { + redir https://${mpdVhost}{uri} + } ''; }; @@ -196,7 +204,7 @@ # MPD music playing daemon with webinterface services.ympd = { enable = true; - webPort = "8080"; + webPort = toString ympdPort; }; }