From 008ae03557f86da09300762645d513ae42871df1 Mon Sep 17 00:00:00 2001
From: Bolke de Bruin <bolke@xs4all.nl>
Date: Thu, 4 Aug 2022 21:49:59 +0200
Subject: [PATCH] TLS updates

---
 README.md         | 2 +-
 cmd/rdpgw/main.go | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index a87f7f5..606a338 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ server:
  keyFile: key.pem
  # gateway address advertised in the rdp files
  gatewayAddress: localhost
- # port to listen on
+ # port to listen on (change to 80 or equivalent if not using TLS)
  port: 443
  # list of acceptable desktop hosts to connect to
  hosts:
diff --git a/cmd/rdpgw/main.go b/cmd/rdpgw/main.go
index 3ca4c20..1736a8f 100644
--- a/cmd/rdpgw/main.go
+++ b/cmd/rdpgw/main.go
@@ -143,7 +143,11 @@ func main() {
 	http.HandleFunc("/tokeninfo", api.TokenInfo)
 	http.HandleFunc("/callback", api.HandleCallback)
 
-	err = server.ListenAndServeTLS("", "")
+	if conf.Server.DisableTLS {
+		err = server.ListenAndServe()
+	} else {
+		err = server.ListenAndServeTLS("", "")
+	}
 	if err != nil {
 		log.Fatal("ListenAndServe: ", err)
 	}
-- 
GitLab