-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger navigates to wrong UI URL when using Virtual directory in Owin enabled asp.net #1292
Comments
I have the same problem. |
Yep, same for me. |
Any progress for this issue? I have a similar problem. |
Any solution for this ?? I'm facing the same issue. Thanks in advance. |
Same problem here. |
Same problem... |
I've just resolved my problem removing "RootUrl" from the EnableSwagger, Swashbuckle now create the correct URL for my API hosted in a virtual directory. |
I had this. Once you set the RootUrl resolver in EnableSwagger as suggested by @pjc2007, it will work, however the old redirect might be cached by your browser - took me a few minutes to work that out. swagger.RootUrl(resolver =>
resolver.RequestUri.GetLeftPart(UriPartial.Authority) + resolver.GetRequestContext().VirtualPathRoot.TrimEnd('/')); |
same problem |
I'm hacking it with the use of Referrer as UI is loaded by the browser, the referrer is auto send and this makes it work
Would be nice if Swagger was using JS (window.location) to check the location of index.html (or any other start page is possible to configure) and assume that URL is the base url for all requests |
VERSION:
Provide the version of Swashbuckle you're using
STEPS TO REPRODUCE:
I have an asp.net webApi application, where I have just installed Swashbuckle. Very similar to this issue when I navigate to
http://localhost/myapp/swagger
is redirects tohttp://localhost/swagger/ui/index
. If I manually then insert the virtual directory, iemyapp
, it works, ie if I manually enterhttp://localhost/myapp/swagger/ui/index
I get the UI that displays my routes.I have the following setup code
I have modified the
c.RootUrl(req =>req.RequestUri.GetLeftPart(UriPartial.Authority) +req.GetRequestContext().VirtualPathRoot.TrimEnd('/')); as per the FAQ. Before I did this, even when I manually entered the
http://localhost/myapp/swagger` the routes did not display, as the incorrect url also was entered into the UI "explore" box, however, adding the RootUrl as above fixed this.The only thing it did NOT fix was the initial navigation to the swagger UI. Note that once I get to the UI, all else seems to work.
EXPECTED RESULT:
Simply some instruction (or otherwise) on how to configure (or work around) getting to the Swagger UI for an asp.net Owin project.
So, when I navigate to http://localhost/myapp/swagger` is redirects to
http://localhost/myapp/swagger/ui/index
. If solved, would then be good to add this to the FAQACTUAL RESULT:
When I navigate to
http://localhost/myapp/swagger
is redirects tohttp://localhost/swagger/ui/index
.The text was updated successfully, but these errors were encountered: