Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually:

spring – How to change url of Swagger SpringMVC UI – Stack Overflow

swagger2的页面报错:Unable to infer base url…

和spring-security配置有关

解决办法:.antMatchers(“/v2/api-docs”, “/configuration/ui”, “/swagger-resources”, “/configuration/security”, “/swagger-ui.html”, “/webjars/**”,”/swagger-resources/configuration/ui”,”/swagge‌​r-ui.html”).permitAl‌​l()

swagger ui – Why does springfox-swagger2 UI tell me “Unable to infer base url.” – Stack Overflow 解决方案;

配置完上面所说的还是有出现问题;

1,问题的思考,是否是有还有其它的配置请求进行拦截;检查配置。

2,登录的拦截器;

3,MVC中的messageConverts;