Skip to content

Conversation

@xiefangzhenz
Copy link

知识星球关于访问日志无法插入的问题。
当项目添加servlet.context-path的时候,过滤器进行前缀检测,无法检测到相关路径,会导致日志记录出现问题。
iShot_2025-01-03_10 43 36

protected boolean shouldNotFilter(HttpServletRequest request) {
// 只过滤 API 请求的地址
return !StrUtil.startWithAny(request.getRequestURI(), webProperties.getAdminApi().getPrefix(),
String contextPath = request.getContextPath();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String apiUri = request.getRequestURI().substring(request.getContextPath().length());
return !StrUtil.startWithAny(apiUri, webProperties.getAdminApi().getPrefix(), webProperties.getAppApi().getPrefix());

可以考虑优化下

Copy link
Author

@xiefangzhenz xiefangzhenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢您的建议,我已根据您的反馈进行了修改。

@YunaiV YunaiV merged commit d7c01b7 into YunaiV:master Feb 8, 2025
YunaiV added a commit that referenced this pull request Feb 9, 2025
mapleafly pushed a commit to mapleafly/ruoyi-vue-pro that referenced this pull request Feb 17, 2025
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.

2 participants