This is a bit complicated, not knowing what your conditions are, but I would go the way of getting an attribute from RequireHttpsAttribute and overriding HandleNonHttpsRequest. In this method, you can check your condition and react accordingly.
source share