新版 google 谷歌浏览器跨域问题(Cross domain issues in the new version of Google browser)

新版本的firefox火狐浏览器限制了 127.0.0.1

本地部署测试的时候,用火狐浏览器需要把 前端的 后台中的服务地址改成 http://localhost:8081

浏览器访问的时候也用 http://localhost:8080

完事清理浏览器缓存,否则没生效

如果是服务器部署,把localhost改成实际服务器IP或者域名

==========================================

google 浏览器,当前端和后台在同一个电脑上时

后台 中的服务地址如果是 http://localhost:8081

那么浏览器访问的时候也用 http://localhost:8080

后台中的服务地址如果是 http://127.0.0.1:8081

那么浏览器访问的时候也用 http://127.0.0.1:8080

如果是域名或者外网IP,同理

后台 中的服务地址如果是 http://www.xxx.com:8081

那么浏览器访问的时候也用 http://www.xxx.com:8080

地址要一样,端口不同

google 浏览器,当前端和后台不在同一个电脑上时

需要修改如图配置

(注意,只要修改后台 都要使劲清理浏览器缓存)

 Chrome 91版本之后设置如下

找到google Chrome快捷启动图标,右键,属性,添加红色字样的一串代码(红字前面是一个空格,否则保存不了)

快捷方式-》目标:

“C:\ProgramFiles\Google\Chrome\Application\chrome.exe”–disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure

(新版谷歌浏览器的默认配置变动了,导致跨域门槛提高了,本身前端和后台的端口不同也是跨域,如果IP不同需要修改浏览器配置了。以前的谷歌浏览器没这个问题,可能以后的版本还会更新变更回来,火狐等非google内核的浏览器没这个问题,

所以,只有两个条件同时满足时才需要修改这个浏览器配置

  • 使用google内核浏览器
  • 前端和后台部署在不同的服务器上

其它情况不需要修改这个配置

————————

The new version of Firefox is limited to 127.0.0.1

When deploying the test locally, you need to change the service address in the background of the front end to http://localhost:8081

It is also used when accessing the browser http://localhost:8080

Clean up the browser cache after completion, otherwise it will not take effect

For server deployment, change localhost to the actual server IP or domain name

==========================================

google   Browser, when the current end and background are on the same computer

Service address in the background if yes http://localhost:8081

So it is also used when accessing the browser http://localhost:8080

Service address in the background if yes http://127.0.0.1:8081

So it is also used when accessing the browser http://127.0.0.1:8080

If it is a domain name or Internet IP, the same is true

Service address in the background if yes http://www.xxx.com:8081

So it is also used when accessing the browser http://www.xxx.com:8080

The address should be the same and the port should be different

google   Browser, when the current end and background are not on the same computer

The configuration shown in the figure needs to be modified

(note that as long as you modify the background, you should try your best to clean up the browser cache)

After chrome 91, the settings are as follows

Find the Google Chrome quick start icon, right-click, properties, and add a string of code with red characters (a space in front of the red character, otherwise it can’t be saved)

Shortcut – target:

“C:\ProgramFiles\Google\Chrome\Application\chrome.exe”–disable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure

(the default configuration of the new version of Google browser has changed, which has raised the cross domain threshold. The different front-end and back-end ports are also cross domain. If the IP is different, the browser configuration needs to be modified. The previous version of Google browser does not have this problem, and it may be updated and changed in the future version. Firefox and other non Google kernel browsers do not have this problem,

Therefore, the browser configuration needs to be modified only when the two conditions are met at the same time

  • Using Google kernel browser
  • Front end and back end are deployed on different servers

This configuration does not need to be modified in other cases