关于java:使用域名访问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. 状况阐明

  1. 应用IP拜访localhost:8080/api/swagger-ui.html 没有问题
  2. 应用nginx映射当前,拜访https://www.xxxxx.com/api/swa… 开始呈现问题

3. 百度过程遇到的坑

  1. 解决办法:在启动类上加上注解@EnableSwagger2
  2. 被拦挡

    /swagger-ui.html
    /webjars/**
    /v2/**
    /swagger-resources/**

4. 问题排除过程

  1. 减少EnableSwagger2
  2. 我的项目当中没有应用拦挡
  3. 在页面应用F12查看报错

  4. 查看此ERR_CONTENT_LENGTH_MISMATCH阐明

    1. 发现貌似是nginx问题
  5. 查看nginx谬误日志
  6. 发现proxy_temp目录没有权限
  7. 偷懒赋予777权限

5. 有帮忙的连贯

https://blog.csdn.net/mr_ooo/…

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理