Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/auxiliary.go')
-rw-r--r--internal/handlers/auxiliary.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/handlers/auxiliary.go b/internal/handlers/auxiliary.go
new file mode 100644
index 00000000..443e6416
--- /dev/null
+++ b/internal/handlers/auxiliary.go
@@ -0,0 +1,16 @@
+package handlers
+
+import (
+ "net/http"
+
+ "gitlab.com/gitlab-org/gitlab-pages/internal/request"
+)
+
+func RedirectToHTTPS(w http.ResponseWriter, r *http.Request, statusCode int) {
+ u := *r.URL
+ u.Scheme = request.SchemeHTTPS
+ u.Host = r.Host
+ u.User = nil
+
+ http.Redirect(w, r, u.String(), statusCode)
+}