-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 UI not working while API service behind reverse proxy #1892
Comments
I'm looking at SwaggerDocumentMiddleware. It looks like GenerateSwaggerAsync caches generated _swaggerJson document. The issue is that when an application is deployed behind a reverse-proxy, e.g. nginx, uses the PostProcess handler to override host/basePath properties and the application is also accessible from the internal network, then the cached JSON document works either from public or internal network. In other words, if somebody accesses (performs the first HTTP request) the application from the internal network, then it won't work from the public network and vice versa. What if to store _swaggerJson in a sort of dictionary, e.g.
? This approach allows to workaround the issue without much refactoring. |
@StasPerekrestov looks fine to me... so this would be needed if the swagger ui is exposed on two different urls? |
@RicoSuter exactly. I'll prepare a pull request and create a separate issue. |
@StasPerekrestov, @RicoSuter I'm having the same issue since about 3 months. The problem for me is that when I install my server application on our test server, if I open the API from |
Please review this PR: #2196 |
The PR has been merged, why is this still open? |
Let's close... |
With reference to #1717, I need some help about configuration of Swagger when using API behind a reverse proxy. In this case the reverse proxy should be IIS. But I also want to know if and what are the possible differences to take into account if I change the proxy server.
Right now I'm using this configuration:
And I'm getting this problem:
But, when used without proxy, everything works.
As @deepforest was suggesting in #1717:
What should I do to make it works?
The text was updated successfully, but these errors were encountered: