When Solomon completed the First Temple and prepared to carry the Ark of the Covenant through the main gates, he opened his mouth to sing the words of Psalm 24: Lift up your heads, O ye gates! and the King of glory shall come in.
The gates heard King of glory and thought he meant himself.
According to Midrash Devarim Rabbah (chapter 15), the lintels began to descend. The doorposts leaned inward. The gates were preparing to crush the king on the threshold as punishment for hubris. Solomon would have died under his own architecture.
He saved himself by changing the line. The Lord of hosts — He is the King of glory (Psalm 24:10). The gates heard the correction, lifted their heads, and let him and the Ark pass.
The Holy One, Blessed be He, remembered that moment. Because you gates refused to bow to a man, He said, when the Temple is destroyed, no man shall have dominion over you. You will not be carried off as plunder.
And so it was. When Nebuchadnezzar sacked Jerusalem, the vessels — the menorah, the table, the altars — were all carted to Babylon. But the gates, the midrash says, sank into the ground exactly where they stood. Lamentations 2:9 is the proof-text: Her gates are sunk into the earth.
They are waiting there still, the rabbis say, for the Temple that will be rebuilt above them — the one whose King of glory they can finally welcome by name.