Are 127.0.0.1 and localhost considered as two different domains by browsers?

随声附和 提交于 2019-11-29 14:50:56

Origin is defined as a scheme/host/port (port is the default value for a scheme if it doesn't exist, e.g. port 80 for http, 443 for https). Same-origin is defined as a matching scheme/host/port. "localhost" and "127.0.0.1" are different hosts in this case. See http://en.wikipedia.org/wiki/Same_origin_policy#Origin_determination_rules

Yes, these are different origins for web security purposes; no browsers equate them. Technically "localhost" can point anywhere, and typically (on modern systems) it points to IPv6 rather than IPv4.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!