make it work with https as well thanks to @drbrts