Springdoc-openapi: Generated server url is HTTP

Created on 11 Jun 2020  路  2Comments  路  Source: springdoc/springdoc-openapi

Describe the bug
When deployed, the server URL is right, except for the scheme: it is using HTTP instead of HTTPS, hence resulting in "Fail to fetch" errors.

To Reproduce

  • deploy the app on localhsot
  • use nginx to make it available under https
  • open swagger ui

Expected behavior

  • the generated server URL should match the root of the documentation

Screenshots

As we can see, the root URL is https://bbdata.daplab.ch, but the generated server URL is http://....

image

Additional context
I am using version 1.4.1.

Here is the relevant part of my application.properties:

##聽Documentation
# Paths: UI at /docs/api, yaml at /docs/api/bbdata{.yaml}
springdoc.swagger-ui.path=/docs/api
springdoc.api-docs.path=/docs/api/bbdata
# do not expand tags
springdoc.swagger-ui.doc-expansion=none
# sort tags alphabetically
springdoc.swagger-ui.tags-sorter=alpha
springdoc.swagger-ui.operations-sorter=alpha
# show actuator endpoints
springdoc.show-actuator=true

Most helpful comment

I was able to make it work be specifying the server url as / in the configuration:

@OpenAPIDefinition(
    servers = arrayOf(Server(url = "/"))
)
@SpringBootApplication
class App{
// ...
}

All 2 comments

I was able to make it work be specifying the server url as / in the configuration:

@OpenAPIDefinition(
    servers = arrayOf(Server(url = "/"))
)
@SpringBootApplication
class App{
// ...
}

I was able to make it work be specifying the server url as / in the configuration:

@OpenAPIDefinition(
    servers = arrayOf(Server(url = "/"))
)
@SpringBootApplication
class App{
// ...
}

You'd just saved my whole career!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

durimkryeziu picture durimkryeziu  路  4Comments

urswiss picture urswiss  路  5Comments

SSK-code picture SSK-code  路  4Comments

GrmpfNarf picture GrmpfNarf  路  3Comments

bfs-natewallman picture bfs-natewallman  路  4Comments