Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相对路径咨询 #1206

Closed
hehanli101 opened this issue May 11, 2024 · 1 comment
Closed

相对路径咨询 #1206

hehanli101 opened this issue May 11, 2024 · 1 comment
Labels
docs Improvements or additions to documentation

Comments

@hehanli101
Copy link

hehanli101 commented May 11, 2024

子应用的接口请求发出的时候,请求的地址是‘/api/platform/file?keyword=&pageNo=5&pageSize=10’,

但是基座渲染子应用,这个接口在请求时会自动被浏览器补全为fetch(子应用域名 + '/api/platform/file?keyword=&pageNo=5&pageSize=10'),也会存在跨域问题
axios({ method: 'get', url: '/api/platform/file?keyword=&pageNo=5&pageSize=10', headers:{ Authorization:'Bearer 954071fbcd084f2bb5707bbf193a67d4' } })
我看文档常见问题写的是
2、请求的接口为相对地址,会以基座域名进行补全,导致报错。
如:fetch('/api/data'),在请求时会自动被浏览器补全为fetch(基座域名 + '/api/data')

不知道是不是我使用的问题

我希望的是子应用按照基座域名进行补全,我想通过nginx代理转发,不想进行跨域的配置

image

@bailicangdu
Copy link
Member

@bailicangdu bailicangdu added the docs Improvements or additions to documentation label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants