-
Notifications
You must be signed in to change notification settings - Fork 383
The problem of the default listening address of.Net9 WebAPI #4082
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
Comments
Hi, I’m not entirely sure I understand the issue you're describing. Scalar relies on the generated OpenAPI document and uses the server information provided within it. The document generator in |
I had the same problem, but it only happens in development environment:
"Kestrel": {
"Endpoints": {
"Default": {
"Url": "http://+:8080"
}
}
},
"AllowedHosts": "*"
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"SystemLog__MinimumLevel__Default": "Debug"
}, Fix: "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"Kestrel__Endpoints__Default__Url": "http://localhost:8080",
"SystemLog__MinimumLevel__Default": "Debug"
}, |
Yes. The link I shared in the previous comment refers to the implementation in the This is not an issue in the |
@xC0dex IMO the bug is that scalar is using the "servers" to build the callback address:
This entry is only present in development environment, and it reflects what is configured in kestrel settings, but is not the callback address, that's why it always works in productive environment where the "servers" entry is not present. |
Probably I didn't get it right, sorry. What do you mean with the callback address? |
When the "servers" entry is absent, scalar uses the correct host and everything works fine |
I believe this still seems more like a feature than a bug. If a |
I agree that, looking at the OpenAPI schema documentation, Microsoft seems to be wrong. The best workaround seems to be the custom document transformer that clears the servers entries to prevent the invalid server entry. |
I'll close this issue because the bug itself is not |
What happens?
Previously, I defaulted to using urls in appsetting.json as listening, but in the UI it became [::]:9001. Using seed also indicated cross-domain issues. The same SwaggerUI does not have this problem.
What did you expect to happen?
To solve the problem, I used the following code:
plesase don't let them happen again
OpenAPI Document
No response
The text was updated successfully, but these errors were encountered: