I always personally thought that browsers would treat sites operating from different ports at the same domain name or IP address as unrelated, for things like cookies or same-origin policy, but your experience seems to indicate this isn't the case.
So I think the answer to your question is: No, this is not possible. I would suggest looking into some kind of dynamic DNS setup.