You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is not really a bug, but it might still be something to think about. Mainly I need support on this.
We use Azure Container Apps and internal communications between services is on http. The ingress uses https. So Swagger UI is served over HTTPS. The problem is that the Open API document has the server URL in HTTP format, not in HTTPS. Swagger UI will try to make a request over HTTP, not HTTPS. This is something that the browser will not allow.
When importing this into Postman it will give me the HTTP server url, but it required HTTPS.
How do I update the Server URL to force HTTPS instead of the HTTP it thinks it is? It is not an option to set ASP.NET to HTTPS because there is no certificate.
The text was updated successfully, but these errors were encountered:
Looking at the source code the Scheme is determined through the HttpContext. I also noticed that there is a HostOverride I can set. This is a nice work-around for now. But it would be nice to be able to do this globally, instead of having to set my custom domain (which the project shouldn't know about) and add it to the environment ocelot config.
Hi @royberris,
Unfortunately, there is currently no direct way to do it globally. However, it is possible to do a custom post-process on the documentation before it is displayed:
publicstringAlterUpstreamSwaggerJson(HttpContextcontext,stringswaggerJson){varswagger=JObject.Parse(swaggerJson);// ... alter upstream jsonreturnswagger.ToString(Formatting.Indented);}app.UseSwaggerForOcelotUI(opt =>{opt.ReConfigureUpstreamSwaggerJson=AlterUpstreamSwaggerJson;})
Describe the bug
This is not really a bug, but it might still be something to think about. Mainly I need support on this.
We use Azure Container Apps and internal communications between services is on http. The ingress uses https. So Swagger UI is served over HTTPS. The problem is that the Open API document has the server URL in HTTP format, not in HTTPS. Swagger UI will try to make a request over HTTP, not HTTPS. This is something that the browser will not allow.
When importing this into Postman it will give me the HTTP server url, but it required HTTPS.
How do I update the Server URL to force HTTPS instead of the HTTP it thinks it is? It is not an option to set ASP.NET to HTTPS because there is no certificate.
The text was updated successfully, but these errors were encountered: