Simple redirect of http URLS to https in Jekyll/Markdown using Javascript code.


This Jekyll blog site is generated by committing to Azure Devops which builds and releases it as an Azure Blob Storage Static Web Site. Unlike Azure Static Web Apps, Azure Storage Static Web Sites do not have a TLS/SSL option. Azure CDNs are used with this site to get the site URL into http://www.<customdomain> then into https://<myname>.<customdomain>. It is desirable to serve up only through SSLs/TLSs and so redirect the http Urls to https. Normally it is simple to map to But in this case there is the complication of mapping www to <myname> as well.

On this site <myname>.<customdomain> is In the code below, this is

Baby steps

An .htaccess file was tried but this is an Apache server so it didn’t work. Also …


… was also tried. This worked on the development machine but not when deployed to Azure via Azure DevOps.

Javascript Solution (Updated)

Map to using Javascript.


Added ability to stop redirection on a specific page by adding the noredirect page property in the page’s FrontMatter. Value doesn’t matter. If that property exists the redirection doesn’t occur for that page. This is useful in development mode!


This code is included in the post page template and the index page and so all http are automatically redirected to https without any code needed in the post .md pages.

This works fine. No need for .htaccess file and minimal Jekyll Liquid code required, etc.

  Next: > Blazor Helpers App Members
 This Category Links 
Category:Web Sites Index:Web Sites
<  Prev:   Azure Static Web Apps