question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated server url is HTTP

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

8reactions
derlincommented, Jun 11, 2020

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

@OpenAPIDefinition(
    servers = arrayOf(Server(url = "/"))
)
@SpringBootApplication
class App{
// ...
}
1reaction
chientrmcommented, Nov 27, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong "Generated server url" in springdoc-openapi-ui ...
Spring Boot 2.2 application with springdoc-openapi-ui (Swagger UI) runs HTTP port. The application is deployed ...
Read more >
API Server and Base Path - Swagger
In OpenAPI 3.0, you use the servers array to specify one or more base URLs for your API. servers replaces the host ,...
Read more >
F.A.Q - Springdoc-openapi
Generating automatically server URL may be useful, if the documentation is not present. If the server annotations are present, they will be used...
Read more >
springdoc-openapi: provide some possibility to open the ...
actually the generated application's OpenAPI documentation url and ... These URLs can have the default values (http://server:port/context-path/v3/api-docs ...
Read more >
'Code First' API Documentation with Springdoc and Spring Boot
Then we can generate our documentation from the API we have already programmed. ... servers = @Server(url = "http://localhost:8080") ) class ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found