{ config, lib, pkgs, ... }: let dn = "tfcconnection.org"; in with lib; { services.nginx.virtualHosts.${dn} = { forceSSL = true; enableACME = true; locations = { "/" = { proxyPass = "http://localhost:4242"; proxyWebsockets = true; }; "tfcconnection.com".return = "301 http://tfcconnection.org$request_uri"; "www.tfcconnection.com".return = "301 http://tfcconnection.org$request_uri"; "www.tfcconnection.org".return = "301 http://tfcconnection.org$request_uri"; extraConfig = '' add_header X-Frame-Options "SAMEORIGIN"; add_header Access-Control-Allow-Origin * add_header Access-Control-Allow-Origin https://api.tfcconnection.org ''; }; }; # systemd.services = { # website = { # enable = true; # serviceConfig = { # ExecStart = "${pkgs.website}/bin/tfcapi"; # }; # }; # }; }