vue-element-admin icon indicating copy to clipboard operation
vue-element-admin copied to clipboard

大佬们,跨域请求403报错,后端已经允许跨域了

Open bobian29c6e opened this issue 1 year ago • 6 comments

555真的没辙了哎 Uploading 截屏2023-10-05 16.55.06.png…

bobian29c6e avatar Oct 05 '23 08:10 bobian29c6e

截屏2023-10-05 16 55 32

bobian29c6e avatar Oct 05 '23 08:10 bobian29c6e

截屏2023-10-05 16 55 54 截屏2023-10-05 16 56 05

bobian29c6e avatar Oct 05 '23 08:10 bobian29c6e

export function adminlist(data) {
  return request({
    url: '/user/adminlist',
    method: 'post',
    data
  })
}

不需要写死地址。可以利用不同的启动命令去启动不同环境。

# just a flag
ENV = 'development'

# base api
VUE_APP_BASE_API = 'http://127.0.0.1:8000/api/'

挂到生产环境上去后。在去用nginx反向代理。可以解决跨域问题。

EITSxiaozhai avatar Oct 05 '23 15:10 EITSxiaozhai

你的Java跨域不正确,如果有使用第三方鉴权框架例如 Shiro或者Sa-token等需要额外配置 对应的跨域配置

liyang-it avatar Oct 23 '23 02:10 liyang-it

前端使用代理试试

Zhuaay avatar Dec 21 '23 08:12 Zhuaay

后端是不是用Spring Security了?用了拦截器这样配置是不生效的

songwe2017 avatar Jan 09 '24 10:01 songwe2017