OpenAPI document has a different PORT #6989
Replies: 4 comments 1 reply
-
See dotnet/aspnetcore#57332. Yes it because of the proxy. The open api support in asp.net core should handle this better. |
Beta Was this translation helpful? Give feedback.
-
As none of the suggestions from dotnet/aspnetcore#57332 worked for me I looked into the cause myself and found a very convenient workaround by reading the actual url from the env-vars and setting it manually:
Optionally you can set the servers in the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This has been fixed in .NET 9.0.4 and .NET 10 Preview 3. Note: that for use with Aspire you'll also have to configure the forwarded headers middleware to get the desired behavior. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm on dotnet 9.0, and somehow
AddOpenApi
creates an openapi spec that has a different port specified in the documentand each time the application starts the port is assigned randomly, I'm guessing that this might somehow be related to the proxy created by aspire?
I use scalar, and this is annoying since everytime I need to call an API after restarting my application, I need to go to
Aspire Dashboard > My application scalar end point > call the api
since upon restart the port changes everytime I cant just keep the scalar page loaded
any idea on how I can disable this? or is this occuring from Aspire at all?
here is my launchsettings.json
openapi generated
Currently I've hardcoded the port in Openapi document transformer, but I would prefer it if there was a better solution to this
Beta Was this translation helpful? Give feedback.
All reactions