
使用域名访问swagger 一直提示Unable to infer base url.
1. 错误提示
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... then the base url is http://example.org/api/. Please enter the location manually:
2. 情况说明
使用IP访问localhost:8080/api/swagger-ui.html 没有问题 使用nginx映射以后,访问https://www.xxxxx.com/api/swa... 开始出现问题3. 百度过程遇到的坑
解决办法:在启动类上加上注解@EnableSwagger2
被拦截
/swagger-ui.html
/webjars/**
/v2/**
/swagger-resources/**
4. 问题排除过程
增加 EnableSwagger2 项目当中没有使用拦截在页面使用F12查看报错
查看此ERR_CONTENT_LENGTH_MISMATCH说明
发现貌似是nginx问题 查看nginx错误日志 发现 proxy_temp目录没有权限 偷懒赋予 777权限5. 有帮助的连接
https://blog.csdn.net/mr_ooo/...
30岁程序员的挣扎之路
氷落
一个年过30,苦苦挣扎的程序员......
氷落
一个年过30,苦苦挣扎的程序员......
宣传栏
目录
1. 错误提示
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... then the base url is http://example.org/api/. Please enter the location manually:
2. 情况说明
使用IP访问localhost:8080/api/swagger-ui.html 没有问题 使用nginx映射以后,访问https://www.xxxxx.com/api/swa... 开始出现问题3. 百度过程遇到的坑
解决办法:在启动类上加上注解@EnableSwagger2
被拦截
/swagger-ui.html
/webjars/**
/v2/**
/swagger-resources/**
4. 问题排除过程
增加 EnableSwagger2 项目当中没有使用拦截在页面使用F12查看报错
查看此ERR_CONTENT_LENGTH_MISMATCH说明
发现貌似是nginx问题 查看nginx错误日志 发现 proxy_temp目录没有权限 偷懒赋予 777权限5. 有帮助的连接
https://blog.csdn.net/mr_ooo/...