How to forbid direct IP visit to discourse?

look at our ssl template it demonstrates how to make a replace rule in pups that amends nginx config.