Swagger url throws ERR_TOO_MANY_REDIRECTS

Hi,

I use the SwaggerFeature plugin in an existing SS API and works great, but this project that I started now, when I go to the swagger-ui url I get this:

(PostmanFeature works great and the API as well… jut not the Swagger part)

I’m using as a host, a WebForms project with only a Global.asax (packages and web.config) - this setup is the same as used in the host project where Swagger works as well - containing:

public class Global : HttpApplication
{
    protected void Application_Start(object sender, EventArgs e)
    {
        // NHibernate & StructureMap initialization
        ServiceLocatorInitializer.Initialize();

        // Service initialization
        new AppHost().Init();
    }
}

How can I debug this part in order to see what is messing up with the Swagger UI?

I would first look at the raw HTTP Responses that are returning the redirects, maybe it will shed some light on why it has a redirect in the first place.

I did, but all I get is 302 requests :frowning:

they are all exact the same…

ok weird, just wanted to check if there was something in the headers indicating what the issue was. I’m not exactly sure what’s doing the redirect since SwaggerFeature doesn’t have any redirects itself. Not sure if it helps but can you provide the /swagger-ui/?debug=requestinfo output in-case there were any StartupErrors?

It ends up in the same loop

I tried also:

  • copy/paste the SwaggerFeature source code
  • comment out all internal properties
  • assign the SwaggerFeature to this instead of ServiceStack.Api.Swagger.SwaggerFeature

and as you said, there’s no redirect in the code, and that just run flawlessly…

and they, just for the kicks, I saw that in the CatchAllhandlers it “talks” about a default.html … so I tried access:

http://localhost:11157/swagger-ui/default.html

and it worked, right from that link!

So, I think I need just to setup my IIS instance (and IIS Express) making sure default.html is a default document.

I’m sorry for all the trouble, but at least, it can be useful for someone else with the same behavior.