title: Set base path for swagger.ui.html
body: <p>Is there any way to move the Swagger 2 content to another base URL?</p>
  
  <p>I have seen "<a href="https://stackoverflow.com/questions/49924266/how-to-do-friendly-base-url-for-swagger-2-8-0">how to do friendly base url for swagger 2.8.0</a>" as well as this kind of workaround:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RequestMapping("/swagger")
  public String greeting() {
      return "redirect:/swagger-ui.html";
  }
  </code></pre>
  
  <p><strong>The problem:</strong> </p>
  
  <blockquote>
    <p>This is not possible in my case! </p>
  </blockquote>
  
  <p>My server hosts two web applications and a REST api which is why I have this monster here:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Controller
  public class ForwardController {
  
      @RequestMapping(value = "/sitemap.xml", method = RequestMethod.GET)
      public String redirectSitemapXml(HttpServletRequest request) {
          return "forward:/a/web/assets/sitemap.xml";
      }
  
      @RequestMapping(value = "/robots.txt", method = RequestMethod.GET)
      public String redirectRobotTxt(HttpServletRequest request) {
          return "forward:/a/web/assets/robots.txt";
      }
  
      @RequestMapping(value = "/*", method = RequestMethod.GET)
      public String redirectRoot(HttpServletRequest request) {
          return "forward:/a/web/index.html";
      }
  
      @RequestMapping(value = "/a/**/{path:[^.]*}", method = RequestMethod.GET)
      public String redirectClients(HttpServletRequest request) {
  
          String requestURI = request.getRequestURI();
  
          if (requestURI.startsWith("/a/admin/")) {
              return "forward:/a/admin/index.html";
          }
  
          return "forward:/a/web/index.html";
      }
  
  }
  </code></pre>
  
  <p>This goes along with Spring Security settings for this setup.</p>
  
  <p>I need swagger to be available under <code>/a/swagger-ui.html</code>, but is this possible?</p>
  
  <hr>
  
  <p>The following cannot work either under my <code>ForwardController</code>:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/50712519/how-to-change-swagger-ui-url-prefix">How to change Swagger-ui URL prefix?</a></li>
  </ul>