I know how you feel, I had complete loss of confidence recently and cantering was hard because I was thinking too much about what if pony goes too fast at some level in my head so was giving mixed signals and not letting pony go forward.
If you need to stay in walk and trot for a session and feel 100% comfortable in that before you canter him do so, nothing wrong with that if you are feeling nervous.
Then when you are having lesson and reassurance of an instructor there do some canter work, even if it is just a lap on each rein. In your head you will then know you can do it and that nothing 'bad' happened.
What also helps is to talk to yourself out loud saying what you are doing as you go, some of best riders I know do it, so you could be trotting then saying I am on right diagonal, this trot is bit slow, I need to make it more active, more leg, on you go pony. When cantering I sometimes do say stuff like, trot is active, I'll canter at next corner, trot, trot, halfhalt, sit, sit, sit, leg back, leg on, if bit slow then say more inside leg, if too fast, whoa and release, I also say heels down to myself a good bit lol
Obviously you don't need to go into so much detail all the time but sometimes thinking out loud and focusing mostly on yourself takes up your focus on what you are doing rather than what you are feeling emotionally, if that makes sense, I also remind myself to breath if I am feeling a bit nervous.
Hope lesson goes well and your confidence comes back soon, I know how horrible it can feel to have lost your nerve.