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

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2017-12-15 16:25:19 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2017-12-15 16:25:19 +0300
commit085252aa150afc37f6757a1419250bb430fa54e1 (patch)
treec6deecea79445f9957eda679dab567f8ca5ac4f0
parent1444e0557e028b16303bd7fc2dfb24837a50d8b6 (diff)
Redirect to HTTPS with some JS mojo
-rw-r--r--layouts/404.html1
-rw-r--r--layouts/default.html1
-rw-r--r--layouts/home.html1
-rw-r--r--layouts/https_redirect.html9
4 files changed, 12 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html
index d2ff5060..a53fb818 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -10,4 +10,5 @@
<%= render '/footer.*' %>
<%= render '/analytics.*' %>
+ <%= render '/https_redirect.*' %>
</html>
diff --git a/layouts/default.html b/layouts/default.html
index 7781b418..b0c9b7c5 100644
--- a/layouts/default.html
+++ b/layouts/default.html
@@ -37,5 +37,6 @@
<%= render '/footer.*' %>
<%= render '/docsearch.*' %>
<%= render '/analytics.*' %>
+ <%= render '/https_redirect.*' %>
</body>
</html>
diff --git a/layouts/home.html b/layouts/home.html
index 1b4db043..784efdc7 100644
--- a/layouts/home.html
+++ b/layouts/home.html
@@ -12,5 +12,6 @@
<%= render '/footer.*' %>
<%= render '/docsearch.*' %>
<%= render '/analytics.*' %>
+ <%= render '/https_redirect.*' %>
</body>
</html>
diff --git a/layouts/https_redirect.html b/layouts/https_redirect.html
new file mode 100644
index 00000000..8624881a
--- /dev/null
+++ b/layouts/https_redirect.html
@@ -0,0 +1,9 @@
+<% if ENV['NANOC_ENV'] == 'production' %>
+<script type="text/javascript">
+ // Redirect to https with javascript
+ var host = "<%= @config[:base_url] %>";
+ if ((host == window.location.host) && (window.location.protocol != 'https:')) {
+ window.location = window.location.toString().replace(/^http:/, "https:");
+ }
+</script>
+<% end %>