Chrome doesn't create cookie for domain=localhost in broken https

后端 未结 4 1579
耶瑟儿~
耶瑟儿~ 2020-12-08 22:43

I have application on my localhost in https. But the certification on localhost is broken.

Below, response header. Problem: MyCookie is not created:

         


        
相关标签:
4条回答
  • 2020-12-08 23:10

    I use Chrome Version 51.0.2704.103 and it is not a problem to set "localhost" as a domain. It was a problem ".localhost" to set and save a cookie.

    0 讨论(0)
  • 2020-12-08 23:21

    Explicit setting domain cookie on localhost doesn't work for chrome.

    From this:

    You can only set domain cookies for registry controlled domains, i.e. something ending in .com or so, but not IPs or intranet hostnames like localhost

    0 讨论(0)
  • 2020-12-08 23:22

    Try to set

    cookie_domain = ""
    

    By this the cookie can be created and will work.

    I've tried it and it was working fine.

    0 讨论(0)
  • 2020-12-08 23:29

    I guess the easiest workaround for this is to add an entry to the hosts file, like

    127.0.0.1    localhost.com    
    

    and then calling http://localhost.com/ instead of just localhost.

    but having said that, this restriction is ridiculous IMO.

    0 讨论(0)
提交回复
热议问题