0

I need to remove the "/swagger-ui" part from the Swagger UI URL. So far I have seen examples of how to add a prefix prior to the "/swagger-ui" such as "/prefix/swagger-ui" but I want to remove it completely and just have the prefix.

localhost:8080/swagger-ui -> localhost:8080/test

I have tried adding the following two to the .properties file but had no luck:

springdoc.swagger-ui.path=/test

springfox.documentation.swagger-ui.base-url=test

-spring-boot version: 2.5.6

I am using the below dependency for Springfox:

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>

I am wondering if there is any other way.

Cugomastik
  • 911
  • 13
  • 22
  • 1
    Do you use Springfox or Springdoc? – Helen Feb 14 '23 at 06:42
  • Hi Helen, good question. I am using Springfox and tried springfox.documentation.swagger-ui.base-url=test but no luck there as well. – Cugomastik Feb 14 '23 at 09:24
  • 1
    What version of Springfox? [This answer](https://stackoverflow.com/a/66640426/113116) contains the relevant configs for v. 3.0.0. 2.x versions will probably need [something like this](https://github.com/springfox/springfox/issues/1080#issuecomment-169185653). – Helen Feb 14 '23 at 09:24
  • I edited the question to show both the spring boot and spring fox versions. I will check both answers. Thanks a lot. – Cugomastik Feb 14 '23 at 09:32
  • @Helen the second suggestion is still having "swagger-ui" keywords in the url so wont do anything good for me. However, the first is very informative. – Cugomastik Feb 14 '23 at 09:47

0 Answers0