I am working on java web application, which works mainly dependent on cookies. As far as i know cookies are created based on the host.Our application will be hosted on a cloud and intranet as well. Here the following is my requirement. I have two instances of my applications running on the same machine and i want to access my application in the same browser. I have accessed the application which are running on two instances with different port numbers in the same browser like below: 1st instance: http://192.234.45.80:8081/myApp 2nd instance:http://192.234.45.80:8082/myApp Since my application from both the instances is running in the same browser, the cookies are created for the 1st instance application will be overwritten by 2nd instance application.The default behaviour of cookie is created under host.but for the above requirement i want to create cookies based on "host and port number", so that the session cookie will be unique.
My Questions: 1) Can i create cookies with "host+portnumber" instead of only host? 2) If this requrement is against security policies, what are security issues i will face? 3) Suppose if there is way to create cookies based on "host+portnumber",how to take care of configuration when i host on the cloud to support DNS(Domain name pointing to the ipaddress+portnumber)?