automatic change principal server for connection - mirroring

Hi, in 3 server i have MSSQL and i run mirroring, principal server, mirror server and witness , when principal server become failover, mirror server change to principal and this is True.
But IP and server name in principal server and mirror server is different, and my application and webs are connect to principal and in Failover connection cannot change automatically.
I changing IP in mirror server to principal Handy , how can i resolve this problem?