Somehow I can't seem to get this right. I have a Stash variable that I'm setting if certain pages need to be redirected to their HTTPS version.
Tried it a number of ways, but very similar to this:
{if {exp:stash:not_empty name="secure" parse="inward" process="inline"} == 1 }
{exp:dm_force_ssl:force parse="inward"}
{/if}
This code resides in an embed btw (template partials approach, where the "secure" variable is set in the parent template partial, then the other variables are pushed into the wrapper). It ends up redirecting every page, not just the ones that fall into the conditional.