wujie icon indicating copy to clipboard operation
wujie copied to clipboard

子应用内嵌在wujie环境下, 请求跨域

Open CodeGod007 opened this issue 4 years ago • 7 comments

子引用单独运行配置代理后跨域没问题, 但是内嵌在wujie环境下请求跨域, 子引用中请求的地址是相对地址 image 不知道文档里写的这个内容应该加在哪里, 我看文档里的内容像是node中使用的, 在vue3的环境中应该写在哪里呢

CodeGod007 avatar Nov 11 '22 10:11 CodeGod007

image 8085端口为子应用服务 3100端口为主应用服务

CodeGod007 avatar Nov 12 '22 08:11 CodeGod007

请问这个问题解决了吗 我也遇到这个问题了

mawenqing1 avatar Nov 23 '22 06:11 mawenqing1

我们这边是这样解决的,在子应用server中配置cors 例如:

server: {
      cors: {credentials:true,methods:"PUT,POST,GET,DELETE,OPTIONS",origin:'http://localhost:3100'},
      host: '0.0.0.0',
      port: 8085,
      proxy: {...}
    }

cors默认为true, 默认true只是携带了 Access-Control-Allow-Origin: *这一个头

wuwen5 avatar Dec 06 '22 10:12 wuwen5

https://segmentfault.com/a/1190000042546656 看我写的这个文章,应该能解决你们跨域问题!

quqingfei avatar Dec 27 '22 07:12 quqingfei

https://segmentfault.com/a/1190000042546656 看我写的这个文章,应该能解决你们跨域问题!

谢谢,解决了我的问题

hqzh avatar Jan 12 '23 03:01 hqzh

https://segmentfault.com/a/1190000042546656 看我写的这个文章,应该能解决你们跨域问题!

谢谢,解决了开发环境的跨域,测试环境怎么解决,请问有方案吗?

LeonIsACoder avatar Jun 08 '23 01:06 LeonIsACoder

遇到一样的问题, image

zswfisher avatar Oct 07 '23 09:10 zswfisher