my dragons do it for only 2 reasons:
1. it's feeding time and they are trying to get down to where the food is.
2. they are trying to get out of the viv. <--- with this one the best way to get them to stop is to take them out for a little bit. they are very curious creatures and like to explore. when you let them run around and look at things, even if it is only the couch, they calm down exponentially.
if you let them rub against the glass they will end up wearing down the skin on their face creating an open wound and become prone to infection.