How to set up a working HTTPS encryption with netlify, blogdown, and rbind.io

[This article was first published on R-post | Cosima Meyer, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you host a website, it is worth considering using the secure HTTPS encryption instead of HTTP (also in light of the GDPR).1 As someone who is less experienced in setting this up, this can be challenging, particularly if you use a domain that you do not personally own. This post is meant to give a (really) short step-by-step guide for those in a similar situation.

The situation

I build my homepage using the wonderful blogdown package with a customized version of the Hugo Academic theme. To deploy the website, I rely on Netlify, which works like a charm! Since I did not want the default netlify.app domain (suffix) to be my domain, I oppened an issue to request the rbind.io suffix. Setting this up is extremely straightforward and well explained here. Well, now that this worked, I wanted to be able to use HTTPS instead of HTTP. And here, the challenge began.

The solution πŸ’‘

In retrospect, it was all nicely explained in the answer to my issue, which I was not aware of back then. I hope this post will pop up for future users and point them quickly to the solution.

The excellent description by Yihui Xie describes everything what you need to do (and to know). Here is what I did using my own words:

  1. Open your website .Rproj in RStudio
  2. Open a new plain Text File
  3. Copy the following line and replace the word domain so that it matches your website name (for me, it would be cosimameyer).
http://domain.rbind.io/* https://domain.rbind.io/:splat 301!
  1. Save the file as _redirects (no suffix needed) in the static folder of your website. This is how the (simplified) root overview of your folder should look like:
β”œβ”€β”€ R
β”œβ”€β”€ README.md
β”œβ”€β”€ assets
β”œβ”€β”€ config
β”œβ”€β”€ config.toml
β”œβ”€β”€ content
β”‚ β”œβ”€β”€ about
β”‚ β”œβ”€β”€ authors
β”‚ β”œβ”€β”€ courses
β”‚ β”œβ”€β”€ home
β”‚ β”œβ”€β”€ post
β”‚ β”œβ”€β”€ project
β”‚ β”œβ”€β”€ publication
β”‚ β”œβ”€β”€ slides
β”‚ └── talk
β”œβ”€β”€ index.Rmd
β”œβ”€β”€ libs
β”œβ”€β”€ Your-website.Rproj
β”œβ”€β”€ netlify.toml
β”œβ”€β”€ public
β”œβ”€β”€ resources
β”œβ”€β”€ static
β”‚ └── _redirects
└── themes

You’ll see that _redirects is located directly in the static folder.

Well, and that’s it – this little trick did the magic for me! πŸͺ„


  1. For a short overview of the difference between HTTPS and HTTP, see here.β†©οΈŽ

To leave a comment for the author, please follow the link and comment on their blog: R-post | Cosima Meyer.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)