PanJiaChen / vue-element-admin

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
MIT License
87.67k stars 30.43k forks source link

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

Open bobian29c6e opened 12 months ago

bobian29c6e commented 12 months ago

555真的没辙了哎 ![Uploading 截屏2023-10-05 16.55.06.png…]()

bobian29c6e commented 12 months ago
截屏2023-10-05 16 55 32
bobian29c6e commented 12 months ago
截屏2023-10-05 16 55 54 截屏2023-10-05 16 56 05
EITSxiaozhai commented 12 months ago
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反向代理。可以解决跨域问题。

liyang-it commented 11 months ago

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

Zhuaay commented 9 months ago

前端使用代理试试

songwe2017 commented 8 months ago

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