When the Messenger of Allah ﷺ arrived from his hajj, he entered Medina, and made (his camel) kneel down at the gate of his mosque; and he entered it and offered two rak'ahs of prayer; he then returned to his home. Nafi' said: Ibn Umar also used to do so.
أَنَّ رَسُولَ اللَّهِ ﷺ حِينَ أَقْبَلَ مِنْ حَجَّتِهِ دَخَلَ الْمَدِينَةَ فَأَنَاخَ عَلَى بَابِ مَسْجِدِهِ ثُمَّ دَخَلَهُ فَرَكَعَ فِيهِ رَكْعَتَيْنِ ثُمَّ انْصَرَفَ إِلَى بَيْتِهِ قَالَ نَافِعٌ فَكَانَ ابْنُ عُمَرَ كَذَلِكَ يَصْنَعُ