expose external REST API. Failed to load remote configuration

See original GitHub issue

Unable to expose external API from a spring boot project using swagger-config.json with below content

To Reproduce Create 2 Spring Boot 2.3 web projects with springdoc-openapi-ui(1.3.9)

  1. Project 1 - create REST APIs. API docs available at http://localhost:8080/v3/api-docs
  2. Project 2 - access the openapi docs from Project 1 using swagger-config.json with below content located in resources folder
{
  "urls": [
    {
      "url": "http://localhost:8080/v3/api-docs",
      "name": "members"
    }
  ]
}

application.properties for project 2

springdoc.swagger-ui.configUrl=swagger-config.json
server.port=8093
springdoc.cache.disabled= true

Security is not configured for the project When we access http://localhost:8093/swagger-ui.html we get error on page “Failed to load remote configuration” Error snippet below


GET "/swagger-config.json", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
[nio-8093-exec-3] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to HandlerExecutionChain with [ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]] and 3 interceptors
[nio-8093-exec-3] o.s.w.s.r.ResourceHttpRequestHandler     : Resource not found
[nio-8093-exec-3] o.s.web.servlet.DispatcherServlet        : No view rendering, null ModelAndView returned.
 [nio-8093-exec-3] o.s.web.servlet.DispatcherServlet        : Completed 404 NOT_FOUND, headers={masked}

Expected behavior Should be able t view API documentation of project 1 in project 2 when we access http://localhost:8093/swagger-ui.html Screenshots getting below error when we access image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bnasslahsencommented, May 24, 2020

You should make sure your swagger-config.json is located to in static folder (standard spring configuration). In your IDE it (src/main/resrouces/static)

Is it your case ?

1reaction
bnasslahsencommented, May 23, 2020

@sandeepamilineni,

It should be better if you set:

springdoc.swagger-ui.configUrl=/swagger-config.json

No ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

springboot swagger3 "Failed to load remote configuration."
It turned out to be a problem related to openapi-ui, because I was able to solve it when I cleared the browser cache...
Read more >
Microservices API Documentation with Springdoc OpenAPI
Using Springdoc library for generating OpenAPI / Swagger documentation for Spring Boot application and exposing it on Spring Cloud Gateway.
Read more >
java Spring Boot with Swagger - Failed to load remote ...
[Solved]-java Spring Boot with Swagger - Failed to load remote configuration-Springboot ... it shows that you have "/pow-wow/" in your path. Swagger needs...
Read more >
OpenAPI 3 Library for spring-boot
OpenAPI 3 Library for spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI ...
Read more >
Tutorial: Host RESTful API with CORS - Azure App Service
Specifying AllowAnyOrigin and AllowCredentials is an insecure configuration and can result in cross-site request forgery. The CORS service ...
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