FreeBSD pkg SSL unknown protocol

I just upgraded my FreeBSD 10.x boxes to the latest pkg version (1.8.4) and received the following error when doing a pkg update.

SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

A lot of them. And I've never seen this before with pkg.

It looks like something changed in pkg and I had made a misstake back in the days in my pkg repos config file.

I'm running my own FreeBSD pkg repo with Poudriere. First I only served my pkgs over http but I later switched to https. When doing the switch it seems that I forgot to change mirror_type in my pkg repos config file. The URL was changed to https but mirror_type was still set to http. This worked fine until today. Because of this my pkg repo broke when upgrading to pkg version 1.8.x I think.

Solution and fix

Change the pkg repo file in /usr/local/etc/pkg/repos and set mirror_type to https if serving packages over https.

mirror_type: "https"