Usually lightning strikes at the block denoted by
this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos)
or, if an entity is found in a 3x3 box around the lightning, it strikes at the location of the entity (or selects a random one if there are multiple).
Spectators, as of right now, count towards the above exception, causing lightning to potentially strike at their location if they are found in the 3x3 AABB around the initial strike position, giving away the spectator position as well as preventing the lightning from properly striking either at its default location based on the highmap or even another entity in the 3x3 AABB.
You can replicate this by causing a thunderstorm via the weather command, flying above the ground level in spectator and waiting for a lightning strike to strike your in-air location.
Ran into this as well, attached are screenshot and a copy of the HAR of the request.
[media]