Canon is determined by whomever is paying the Writers and Editors of a given work.
That can be the owners. Or it can be no one.
Canon is "The events and concepts of what happened in previous works that are carried forward into new content." Midichlorians were "The New Canon" in the Prequels. They were swiftly discarded because no one liked them. Disney does not reference them with their continued work. Does this mean Midichlorians aren't a thing? No. They're just so utterly irrelevant that not even the current writers care about them. Does this mean Midichlorians -are- a thing? No. They're just so utterly irrelevant that not even the current writers care about them.
They exist only so long as the writer determines they exist. And only so much as the writer determines they exist. No more. No less.
"Fanon" is the body of lore that a fan community largely agrees on and applies to works coming out of a group of writers for their own enjoyment. Sometimes it lines up, sometimes it doesn't. Sometimes that's because the writer didn't find it relevant to the story and left it out, sometimes it's because the writer wished to exclude it because they found that particular bit of previously established lore to be silly or bad. But the Canon is whatever the writer writes.
Headcanon isn't what the community largely agrees on (though they might) but what a given person chooses to establish as the basis of their understanding. It's also not the canon unless they're writing the story because Canon is only what the writer writes.
"Fanfiction" is just it's own separate canon by a given writer. There may be "Official" canon, but ultimately that's just something some part of the community or another considers important lore. The canon is whatever the fanficcer writes.
This is especially important to understand in the case of Public Domain works which -best- display how canon -actually- functions.
Mickey Mouse now exists both in the hands of Disney and any number of separate individual writers. Disney can write their own stories about Mickey which may or may not connect to the various stories he's been in over the decades, creating their own canonicity. But. Mickey Mouse now also lives in the canon built around him by independent authors. These works are not "Fanfiction", anymore.
Randy Milholland is a comic artist. He has his own comic that has been running for decades, now, called Something Positive. But he's also a paid comic artist and writer for Popeye. And he now has his own Mickey Mouse comic called "Mousetrapped"
"Mousetrapped" is a webcomic that uses the public domain cartoon, "Steamboat Willie," as basis and...
mousetrappedcomic.blog
Disney does not own this Mickey Mouse, even though it is the same Mickey Mouse as you see in Fantasia. But what is canonical to this comic series is not canonical to what Disney is doing, and Disney's Mickey Mouse's actions are not canonical to this Mickey Mouse. Even though they're the same character.
You could argue that it's a different Mickey Mouse... And that's where different Marvel and DC comic universes come from.
Disney with the Mouse typically handles this by using title cards and the idea that Mickey is an actor. So in any show or movie you see him in that may be official "Micky Lore" or just Mickey playing a character within that specific story. It's why Mickey Mouse doesn't have fantastical magical powers like in Fantasia when he's in a Donald Duck comic strip.
But since Mickey now exists in the Public Domain, whose decision takes priority? Within the Mousetrapped stories Randy Milholland could say everything happening in Disney's vast non-Moustrapped stories of Mickey Mouse are just a dream. While Disney can claim that the Mousetrapped stories are an alternate universe. So which one is the truth?
The answer is: The truth is the one that applies to a given story. If you're reading a Disney story about Mickey Mouse then Mousetrapped is an alternate universe. If you're reading a Milholland Mickey Mouse comic then the Disney Mouse is a dream. Neither is "Fanon" of the other. They're not Headcanons. They're just canons.
Everything else is people trying to assign or ascribe their own particular idea of what is important or "Real" to a given story or body of works by authors.
Once you break away from this mindset of a hierarchy it's a lot easier to just enjoy things as they are. You don't need to know whether the old Golden Age Superman comic where he shoots tiny versions of himself out of his palms are "Canon to the Modern Universe" in order to enjoy it as a silly story where Superman shoots tiny versions of himself out of his palms.
And yes. That -was- a real comic book. Superman #125 in 1958. And it's just as canonical as midichlorians.