There is a lot of information "some good, some questionable" out there on the origin of the candy cane but they all offer mostly the same information. So here is a consolidation to make it easy for you to find out the history of the candy cane.
According to one folklore, in 1670, in Cologne, Germany, the choirmaster at Cologne Cathedral, wishing to get the noise down caused by children in his church during the Living Crèche tradition of Christmas Eve, asked a local candy maker for some sweet sticks for them. In order to justify the practice of giving candy to the little children during a worship services, he asked the good candy maker to add a crook to the top of each stick, which would help children remember the shepherds who paid visit to infant Jesus, "Linus from Charlie Brown would be proud". In addition, he used the white color of the converted sticks to teach children about the Christian belief in the sinless life of Jesus. From Germany, the candy canes spread to other parts of Europe, where they were handed out during plays re-enacting the Nativity. As such, according to this legend, the candy cane became associated with Christmastide:aka Christmas time or the Christmas season.
The candy cane has long has been mentioned in literature since 1866. It was first mentioned in association with Christmas in 1874, and as early as 1882 was hung on Christmas trees much like today.
Later on in the state of Indiana, there were stories of a candy maker who wanted to make a candy that could be a reminder of Jesus Christ, so he made a version of a Christmas Candy Cane. He started off with a stick of pure white hard candy. The white color symbolized the virgin birth and the sinless nature of Jesus, and the hard candy symbolized the solid rock which was the foundation of the church, and firmness of the promises of God.
The candy maker made the candy in the form of a J, which again represented the name of Jesus and the staff of the Good Shepherds. He then stained it with three stripes which showed the scourging Jesus received, and symbolized the blood shed by Christ on the cross. When you break the cane, it reminds us that Jesus' body was broken for us.
Then around 1920, Bob McCormack, from Georgia, started making candy canes for others and they to became sought after and so he started his own business called Bob's Candies. Bob McCormack had a brother-in-law, Gregory Harding Keller, who was actually a Catholic priest, and they invented the Keller Machine that made turning straight candy sticks into curved candy canes automatically! In 2005, Bob's Candies was bought by Farley and Sathers but they still make candy canes today!
So I think even if we do not love to eat the fabled candy cane, we may have a little more appreciation of the treat and maybe learn to enjoy the the red and white candy in a different way now!
I hope you have a Blessed and Merry Christmas!