❔ Disable Swagger index.html Routing
I have just added and configured Swagger on my project with a custom rote, however, when launching my app on Debug, Swagger has taken over the root route
/
and redirects it to /index.html
which is 404 because of my custom setup.
How can I tell swagger to quit redirecting this and to leave it alone, and let my other routes take over (as I have a controller mapped to /
)?18 Replies
Show us the config. It's going to be hard, helping you like this.
Sure, I just assumed that it was a default function in Swagger
One second
Then
When I access
/Api
I get swagger as desired. When I access /
however, I get redirected to /index.html
which is absolutely not what I want
Ultimately, what I have works fine, just it insists on overriding my routing for /
Comment out route prefix and see what happens.
Well it's certainly stopped it from redirecting, however it has broken Swagger now
try this
Threw, Request path must not end in a slash
removed
remove the end / from prefix
Now
/Api
is 404, /Api/Developers
returns a broken swagger, but this is not what I wanted to achieve particularlyI do not ever intend to have multiple documents, hence I just want /Api to map to swagger
After searching for some solutions it seems like you need to change
launchSettings
Nope, unfortunately not
I couldn't care less how it launches
The routing itself is broken
you wanna give it a try? try changing the launchUrl in launchSettings from swagger to
Api/Developers
I have no launchUrl at all
The project was not created with Swagger
It launches at /
Swagger is mapping / to a redirect to /index.html and that overrides my controller mapped at /
Hm, then I'm not sure what's the issue mate. Sorry if I wasn't of help
No worries. What I had originally works fine
Just Swagger being an arse
Thank you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.