You’re safe when directly in front of and typically behind groups of stormtroopers attempting to engage a target. By setting them up at an angle like this, their commander improves the likelihood of catching enemies in the hollow cone of blaster bolts on approach.
https://youtube.com/watch?v=5HO70-Rk3jE