Swagger UI Not Loading

swagger failed to load api definition
swagger ui not working on server
swagger ui url
how to access swagger ui
swagger-ui github
update swagger ui
spring boot 2 swagger-ui not working
swagger not working in production

Swagger UI is not loading, Json is loading as expected but issue exists with supported js, css files.

Try to copy the /dist directory in vendor/swagger-api/swagger-ui inside your project. I'm not sure about the proper way, but I was facing the same issue and it worked for me. Also, try to provide more details of the issue you are facing, maybe code snippets too. Alternatively, try the following :

  1. Check if all your controller methods have [http] tag. If they all do and still doesn't work go to step 2
  2. In your configure function to ensure that you have app.UseStaticFiles(); If it still doesn't work go to step 3
  3. Uninstall and reinstall swagger. If it doesn't work go to step 4 (Core Only)
  4. If you are using Core Install Microsoft.AspNetCore.StaticFiles and reference it in your project.

Added Springfox Swagger-UI and it's not working, what am I missing , I ran into this issue because I had endpoints with request mappings that had path variables of this form: /{var}. Turns out that this is an issue for  Are you using swagger-ui from master? If version 2.0.0 or greater, it should work with what you put (I can't test it because you posted images, not JSON). If it's not working AND you're on 2.0.0 or greater, can you open the network panel in chrome and load the ui with api-docs to see what is giving an error?

The reason behind this issue you need to follow the below-mentioned steps:

  1. Under Startup.cs file there is a method "ConfigureServices" in this do the following:

    public void ConfigureServices(IServiceCollection services)
        // Configure database connection
        services.Configure<Settings>(options =>
            options.ConnectionString = Configuration.GetSection("database:ConnectionString").Value;
            options.Database = Configuration.GetSection("Db:Database").Value;
        //register the RecordedMediaContext dependency here
        services.AddTransient<ITestService, TestService>();
        // Register the Swagger generator, defining 1 or more Swagger documents
        services.AddSwaggerGen(c =>
            c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
            // Set the comments path for the Swagger JSON and UI.
            var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
            var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
        // Max file upload sixe 5gb =5,368,709,120 bytes
        services.Configure<FormOptions>(x => x.MultipartBodyLengthLimit = 5368709120);
  2. Then under Configure method under the same Startup.cs file add the following code

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        string baseApiUrl = Configuration.GetSection("BaseApiUrl").Value;
        // Enable middleware to serve generated Swagger as a JSON endpoint.
        // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), 
        // specifying the Swagger JSON endpoint.
        app.UseSwaggerUI(c =>
            #if DEBUG
                // For Debug in Kestrel
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Web API V1");
                // To deploy on IIS
                c.SwaggerEndpoint(""+baseApiUrl+"/swagger/v1/swagger.json", "My API V1");
        if (env.IsDevelopment())
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
        //Accept All HTTP Request Methods from all origins
        //app.UseCors(builder => builder.AllowAnyHeader().AllowAnyOrigin().AllowAnyMethod());
        #if !DEBUG


Swagger UI not loading · Issue #298 · swagger-api/swagger-ui , Sorry this may be a dumb question but what I am missing? I can view my apis array and when I go to http://localhost:9090/api-docs/parties/ I can  I recently pulled the latest swagger-ui from GitHub and now my swagger-ui will not load any spec files, even for examples that previously worked.

Did you enable StaticFiles in your startup?


UI not loading specs, no errors · Issue #644 · swagger-api/swagger , I recently pulled the latest swagger-ui from GitHub and now my swagger-ui will not load any spec files, even for examples that previously  Swagger UI does not load CSS 0 Swagger UI only displays the html, seemingly with no CSS. This is a ASP.Net Core 2.1 project using the SwashBuckle Nuget package version 2.5.0.

I faced same issue: Swagger works just fine locally, but doesn't show UI once published to IIS. The problem was resolved by adding .js and .json files as allowed to Request Filtering feature of IIS. These files are not listed there by default for newly created web sites.

Swagger UI Not Working · Issue #2783 · swagger-api/swagger-ui , I am using jersey 2.25 with swagger 1.5.13. I can Access the Swagger JSON at the following url in my app  I just tried with the latest master branch and i am getting the following errors for the swagger ui :-swagger-ui-standalone-preset.js Failed to load resource: the server responded with a status of 404 (Not Found) swagger-ui.css Failed to load resource: the server responded with a status of 404 (Not Found)

Swagger UI not loading · Issue #1248 · domaindrivendev , Problem i am facing swagger can not load UI , in chorme getting exception like "​Failed to load resource: net::ERR_CONNECTION_RESET" No  I have followed a few tutorials and have gotten this to work at work but for some reason I am not able to get the UI to display but the Swagger Json is created. Last tutorial I looked at is here. My setup is like so: Nuget Package: Swashbuckle.AspNetCore(1.0.0) ConfigureServices Method:

Not load swagger ui (kill chrome browser). · Issue #388 , I faced with issue that my api swagger UI stack and won't load. I tried latest and old swaggeer with provided json - all same result. So probably  I&#39;m using IE 11 and Swagger UI does not display list of API. In Chrome everything works. Using Spring boot and JDK 1.7 This is what I have in pom.xml: jcenter-snapshots jcenter https://jcenter.

Can't find Swagger UI endpoint · Issue #2396 · springfox/springfox , GitHub is home to over 50 million developers working together to host and review springfox-swagger-ui 2.9.2, is not working with AWS ALB. Can't properly load Swagger UI - “Not Found /openapi.json” I made a simple REST API with Python, Flask, Connexion and Swagger. All is working well on my local machine (Windows 10), but not on our server (Debian).

  • Could you add the code where you are adding Swagger UI to your app?
  • Just figured it out , i have wrote " c.RoutePrefix = string.Empty; " under configure.... so i need to access like : localhost:<port> -- then Swagger is loading, /swagger is not required. Thanks for your help :)
  • What's BaseApiUrl?
  • BaseApiUrl will be the domain name like if you are debugging the application then it uses localhost:portnumber//swagger/index.html and if hosted somewhere then its domain name. like baseApiUrl= localhost:port number
  • Why do you need to add that? Swagger should bind to what ever it's listening on and your reverse proxy should just pass the request to the API and return the response.
  • Yes, you are right and it's not working while I deployed it on IIS. I tried it both ways, and it starts working in this way.
  • No Luck still required Css, JS files are not loading
  • already added, but no luck. it is not able to load the required JS, Css for swagger UI.