Swagger nginx转发请求后无法访问解放方案
遇到问题,访问接口文档提示权限不足
{"code":-1`在这里插入代码片`,"message":"缺少访问令牌参数"}
解决方案
private List<String> excludePathPatterns = Lists.newArrayList(
"/doc.html/**",
"/swagger-resources/**",
"/webjars/**");
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(accessIntercept)
.addPathPatterns("/**")
.excludePathPatterns(excludePathPatterns);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}