Force https

This commit is contained in:
Panos Sakkos 2015-10-19 00:16:38 +02:00
parent 8b0d926494
commit b8e2a444d8
2 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,10 @@ baseurl: /personal-jekyll-theme
google-tracking-id: "<YOUR GOOGLE TRACKING ID>" google-tracking-id: "<YOUR GOOGLE TRACKING ID>"
# Forces https everywhere in your website, except when you serve it locally
force-https: True
############# #############
# HTML Head # # HTML Head #
############# #############

View file

@ -36,6 +36,13 @@
{% if site.favicon %} {% if site.favicon %}
<link rel="shortcut icon" type="image/x-icon" href="{{site.baseurl}}{{ site.favicon }}"> <link rel="shortcut icon" type="image/x-icon" href="{{site.baseurl}}{{ site.favicon }}">
{% endif %} {% endif %}
{% if site.force-https %}
<script>
// Don't force http when serving the website locally
if (!(window.location.host.startsWith("127.0.0.1")) && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
{% endif %}
</head> </head>
<!-- HEAD End --> <!-- HEAD End -->