title: Why does springfox-swagger2 UI tell me "Unable to infer base url."
body: <p>Why does springfox-swagger2 UI tell me <code>Unable to infer base url.</code>  As far as I know, I am using a typical Swagger spring-boot configuration.  </p>
  
  <p>As you can see in the screenshot, the swagger-fox url backing the UI is <strong>example.com/api</strong> .  NOTE: I get a standard Spring <code>Whitelabel Error Page</code>  when I navigate to:  <a href="https://localhost:9600/api/v2/api-docs/" rel="noreferrer">https://localhost:9600/api/v2/api-docs/</a>  .  I suspect this is the root of the problem?  I see no errors that Spring didn't load <code>springfox-swagger2</code> and so I don't know why that isn't working.</p>
  
  <p><a href="https://i.stack.imgur.com/i87wJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/i87wJ.png" alt="enter image description here"></a></p>
  
  <p>My config looks something like this  (and I have tried all sorts of variations of this config, from searching the net for advice):</p>
  
  <pre><code>@EnableSwagger2
  @EnableWebMvc
  @ComponentScan(basePackages = {"com.company.project"})
  public class SwaggerConfig
  {
      @Bean
      public Docket api() {
          return new Docket(DocumentationType.SWAGGER_2)
                  .select()
                  .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
                  .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.cloud")))
                  .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.data.rest.webmvc")))
                  .paths(PathSelectors.any())
                  .build();
      }
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>&lt;!-- to generate /swagger-ui.html --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
      &lt;version&gt;2.7.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
      &lt;version&gt;2.7.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>NOTE: Interestingly, when I try version 2.6.0, I don't get the modal popup but my Swagger UI shows 0 api content.  So, i know that modal must be fairly new?</p>
  
  <p>If there is not enough info here, leave me a comment.</p>