Skip to content

✨ 支持 server.servlet.context-path 自适应配置 - #12

Open
yangjinhe wants to merge 1 commit into
moshowgame:masterfrom
yangjinhe:fix/context-path
Open

✨ 支持 server.servlet.context-path 自适应配置#12
yangjinhe wants to merge 1 commit into
moshowgame:masterfrom
yangjinhe:fix/context-path

Conversation

@yangjinhe

Copy link
Copy Markdown
  • AuthInterceptor 剥离 context-path 后再做白名单判断,避免配置 context-path 后登录/首页等接口被 401 拦截
  • 新增 ContextPathAdvice 通过 @ModelAttribute 注入 contextPath 到视图模型(Thymeleaf 3.1 起 #request 不再默认可用)
  • templates/index.html、login.html 注入 window.CONTEXT_PATH,注册 axios 拦截器为 /api/ 请求自动补齐 context path,页面跳转与静态资源路径同步自适应
  • vite dev proxy 支持通过 VITE_API_TARGET 指定带 context-path 的后端地址

- AuthInterceptor 剥离 context-path 后再做白名单判断,避免配置 context-path 后登录/首页等接口被 401 拦截
- 新增 ContextPathAdvice 通过 @ModelAttribute 注入 contextPath 到视图模型(Thymeleaf 3.1 起 #request 不再默认可用)
- templates/index.html、login.html 注入 window.CONTEXT_PATH,注册 axios 拦截器为 /api/ 请求自动补齐 context path,页面跳转与静态资源路径同步自适应
- vite dev proxy 支持通过 VITE_API_TARGET 指定带 context-path 的后端地址
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant