Swagger UI hosted on empty path does not work anymore
See original GitHub issueDid you read the migration guide?
- I have read the whole migration guide
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Potential Commit/PR that introduced the regression
No response
Versions
5.2.0 -> 6.0.4
Describe the regression
Before 6.0, using swagger-ui-express
, it was possible to host the swagger UI on the base url of the NestJS service. Now, the swagger UI doesn’t load, rendering a white page, because requesting swagger-ui-init.js
results in a 404.
It works if I pass another path to SwaggerModule.setup()
(e.g., "api"
). I’ve already tried passing "/"
, but that does not work either.
Minimum reproduction code
const config = new DocumentBuilder()
.setTitle("foo")
.setDescription("bar")
.setVersion("1.0")
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("", app, document);
Expected behavior
Visiting 127.0.0.1:3000
displays the Swagger UI.
Other
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Swagger UI Not Loading - Stack Overflow
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 ...
Read more >NET Core 2.2 and Swagger UI is not Displaying After Publish
hi. I use ASP Core 2.2 my config endpoint: c.SwaggerEndpoint("/swagger/v1/swagger.json", "my api1"); Swagger works in locals.
Read more >Fixing Swagger UI "Try it out" Functionality When Deployed in ...
The Swagger UI renders as what you would expect but you've noticed that the "Try it out" functionality doesn't work anymore and get...
Read more >Swagger UI and no response problem - Google Groups
You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails...
Read more >Swagger UI page is blank on localhost IISExpress SSL URL
It is only the IISExpress SSL URL of 'https://localhost:44387/' that has the empty page. I have spent hours working on this issue with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was just investigating how the paths are handled internally when you pass
""
or"/"
as the path intoSwaggerModule
and when I came here to type what I found I saw you already fixed it a couple minutes ago. Thanks for the quick response!@kamilmysliwiec resolved the issue, here’s the PR https://github.com/nestjs/swagger/pull/2013
P.S. there are bunch of adjustments to make sure it works on ‘/’ path under proxy (https://github.com/nestjs/swagger/issues/1965)