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

1.8.1版本未开启auth并且配置了context-path后访问portal后台页面,部分资源加载404 #3606

Closed
3 tasks done
loadingspace opened this issue Mar 17, 2021 · 0 comments · Fixed by #3609
Closed
3 tasks done
Labels
area/portal apollo-portal kind/report-problem Categorizes issue when someone report the problem he/she meeted

Comments

@loadingspace
Copy link
Contributor

loadingspace commented Mar 17, 2021

描述bug

基于1.8.1版本
portal server 配置apollo_profile未启用auth,并且配置了context-path后访问portal后台页面,部分资源加载404(404请求未带上context-path所配置的路径前缀)

复现

通过如下步骤可以复现:

  1. portal server配置context-path
  2. portal server不使用auth启动
  3. 访问portal server

期望

所有资源正常访问

问题原因

portal不带auth启动时访问页面为index.html,但在该html中未先请求获取prefixPath,导致后续请求资源路径错误

截图

1615620227293_D3A1D438-D49F-4DBA-B485-334B3339A627

额外的细节和日志

  • 版本:1.8.1
  • 错误日志
  • 配置:
  • 平台和操作系统

修改参考

  1. portal中app.html的121行引用路径问题,修改为

    <script src="vendor/lodash.min.js"></script>
  2. portal中index.html的125行到127行中间(该需在加载app.js之前)加入获取context-path请求(可以先判断本地是否存在prefixPath然后在请求)

    <script type="application/javascript"> prefix = function (){ $.ajax({ method: 'get', async: false, url: 'prefix-path', success: function (res) { window.localStorage.setItem("prefixPath", res); } }) }; prefix(); </script>
@Anilople Anilople added area/portal apollo-portal kind/report-problem Categorizes issue when someone report the problem he/she meeted labels Mar 17, 2021
loadingspace added a commit to loadingspace/apollo that referenced this issue Mar 18, 2021
@loadingspace loadingspace mentioned this issue Mar 18, 2021
4 tasks
loadingspace added a commit to loadingspace/apollo that referenced this issue Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/portal apollo-portal kind/report-problem Categorizes issue when someone report the problem he/she meeted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants